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
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/Listings/HaoJin750TFT.map
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/*.uvoptx
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/JLinkLog.txt
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/JLinkLog.txt
......@@ -6,7 +6,7 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
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] =
......
......@@ -3,9 +3,7 @@
#include "Components.h"
#include "CAN_Signal\CAN_Lib.h"
extern st_CanMsgOp CAN_CH0_CanMsgOp;
extern st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
typedef enum
......@@ -23,7 +21,7 @@ typedef enum
typedef enum
{
TEST,
TEST,
CAN_CH0_ID_SEND_TOTAL,
} CAN_CH0_CAN_MSG_SEND_ID_t;
......
This diff is collapsed.
// #ifndef _CAN_USER_H_
// #define _CAN_USER_H_
// #include "RTE.h"
// #include "Components.h"
#ifndef _CAN_USER_H_
#define _CAN_USER_H_
#include "RTE.h"
#include "Components.h"
// /******************************************************************************
// Bus-off
// ******************************************************************************/
// #define RSCAN0_BUS_STABLE 0x00U
// #define RSCAN0_BUS_OFF_LV1 0x01U
// #define RSCAN0_BUS_OFF_LV2 0x02U
// #define RSCAN00_BUS_LIMP 0x03U
// /******************************************************************************
// Bus-off
// ******************************************************************************/
/******************************************************************************
Bus-off
******************************************************************************/
#define RSCAN0_BUS_STABLE 0x00U
#define RSCAN0_BUS_OFF_LV1 0x01U
#define RSCAN0_BUS_OFF_LV2 0x02U
#define RSCAN00_BUS_LIMP 0x03U
/******************************************************************************
Bus-off
******************************************************************************/
// #define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U
// #define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U
#define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U
#define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U
// typedef struct
// {
// uint8_t Status;
// uint8_t Timer;
// uint8_t Cnt;
// uint8_t ReportDTCCnt;
// } RSCAN0BusoffMonitorStruct;
typedef struct
{
uint8_t Status;
uint8_t Timer;
uint8_t Cnt;
uint8_t ReportDTCCnt;
} RSCAN0BusoffMonitorStruct;
// extern void Can_Tx_Apply_Buff(void);
// extern void Can_RX_Apply_Buff(void);
// extern void Can_BusOff_Recover(uint8_t deltaTime);
// extern void COM_CAN_Init(void);
// extern void Can_Init(void);
// extern void Can_Rx_Cak(CanTxRxMsg *Msg);
// extern void Busoff(void);
// extern uint8_t COM_APP_Process(st_CAN_Msg *Msg);
// extern void Can_Write(st_CAN_Msg *Msg);
extern void Can_Tx_Apply_Buff(void);
extern void Can_RX_Apply_Buff(void);
extern void Can_BusOff_Recover(uint8_t deltaTime);
extern void COM_CAN_Init(void);
extern void Can_Init(void);
extern void Can_Rx_Cak(CanTxRxMsg *Msg);
extern void Busoff(void);
extern uint8_t COM_APP_Process(st_CAN_Msg *Msg);
extern void Can_Write(st_CAN_Msg *Msg);
// #endif
#endif
......@@ -4,7 +4,7 @@
uint32_t PowerIgnOnTimeLine;
uint32_t PowerIgnOffTimeLine;
uint32_t PowerIgnOffTimeLine;
static uint32_t PowerSocTimeLine;
......
......@@ -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_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
if(1)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST)
{
DataVSpeedValid = 0;
DataVSpeedActual = 0;
......
......@@ -28,5 +28,7 @@
#include "Data_VSpeed.h"
#include "BackLight.h"
#include "RTC\RTE_RTC.h"
#include "CAN_Signal\CAN_Lib.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#endif
......@@ -5,63 +5,156 @@
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_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_TurnRight, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 60U, 20U, Get_LINE_IN_HighBeam, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 100U, 20U, Get_LINE_IN_Auto_Start_Stop, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Turn_Left, },
{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_High_Beam, },
{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_TurnLeft(void)
Linelib_uint8_t Get_LINE_IN_Turn_Left(void)
{
Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(LeftTurn_P_In))
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
//else
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_TurnRight(void)
Linelib_uint8_t Get_LINE_IN_Turn_Right(void)
{
Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(RightTurn_P_In))
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
//else
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_HighBeam(void)
Linelib_uint8_t Get_LINE_IN_High_Beam(void)
{
Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(HighBeam_P_In))
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
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;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
{
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;
}
//else
else
{
ret = 0UL;
}
......@@ -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)
{
Linelib_uint16_t Res;
//Res = Common_Get_IG_Sts() & 0x00FFu;
Res = Common_Get_IG_Sts() & 0x00FFu;
return Res;
}
......
......@@ -5,19 +5,31 @@
typedef enum
{
LINE_IN_TurnLeft = 0,
LINE_IN_TurnRight,
LINE_IN_HighBeam,
LINE_IN_Turn_Left,
LINE_IN_Turn_Right,
LINE_IN_High_Beam,
LINE_IN_Efi_Fault,
LINE_IN_ABS,
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_Enum_t;
extern void LINE_IN_Init(void);
Linelib_uint8_t Get_LINE_IN_TurnLeft(void);
Linelib_uint8_t Get_LINE_IN_TurnRight(void);
Linelib_uint8_t Get_LINE_IN_HighBeam(void);
Linelib_uint8_t Get_LINE_IN_Turn_Left(void);
Linelib_uint8_t Get_LINE_IN_Turn_Right(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_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
......@@ -53,7 +53,7 @@ static void Power_KL30_Init(void)
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
Amt630hInit();
//Telltales_Init();
Telltales_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
g_stRTCInformation.u8RTCSecond = 0;
......@@ -62,16 +62,15 @@ static void Power_KL30_Init(void)
g_stRTCInformation.u8RTCDayOfMonth = 1;
g_stRTCInformation.u8RTCMonth = 1;
g_stRTCInformation.u8RTCYear = 20;
//RTE_RTC_Init(g_stRTCInformation);
RTE_RTC_Init(g_stRTCInformation);
Menu_User_Init();
Can_Init();
Protocol_KL30_Wakeup_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
}
//extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
{
// PowerIgnOffTimeLine = 0;
Gpio_Init(Gpio_WakeUp_Init);
eeprom_StoreInfo_Init();
Analog_Signal_Conv_Init();
......@@ -86,9 +85,10 @@ static void Power_Wakeup_Init(void)
Amt630hInit();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
//Telltales_Init();
Telltales_Init();
Key_KL30_Init_EXample();
Menu_User_WAKEUP();
Can_Init();
Protocol_KL30_Wakeup_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
}
......@@ -184,6 +184,7 @@ static Power_Status_em Power_Stay_Protect(void)
/* 关闭所有外设,坪保留AD采集,电溝状思切�? */
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
}
u8PowerSts = EM_IGN_OFF_Init;
/* 电溝模弝正常 */
......@@ -196,6 +197,7 @@ static Power_Status_em Power_Stay_Protect(void)
if ( SYS_OPR_STAT_RUN )
{
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
return u8PowerSts;
}
......
//#ifndef TELLTALES_USER_H
//#define TELLTALES_USER_H
#ifndef 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
//{
// em_LED_High_Beam,
// em_LED_Efi_Fault,
// em_LED_Auto_Start_Stop,
// em_LED_Voltage,
// 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
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 @@
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)
{
......@@ -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失败
*/
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反初始化
* @param CANx CAN0 ? CAN1
* @param CANx CAN0 ? CAN1
*
* @return uint8_t 0成功 1失败
*/
......@@ -124,10 +137,10 @@ uint8_t rte_can_deinit(CAN_CH ch)
/**
* @brief 获取CAN是否BusOff
* @param CANx CAN0 ? CAN1
* @param CANx CAN0 ? CAN1
*
* @return uint8_t 0 没有busoff
* 1 错误的操? 2 busoff
* 1 错误的操? 2 busoff
*/
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失败
*/
uint8_t reset_busoff(CAN_CH ch)
......@@ -189,7 +202,7 @@ uint8_t reset_busoff(CAN_CH ch)
return 0;
}
/* 下面是一些例? 自己?
/* 下面是一些例�? 自己�?
CAN_SendMsg.Id = 0x00aa0432;
CAN_SendMsg.IDE = CAN_Id_Extended;
CAN_SendMsg.CacheType = CAN_CacheType_Tx;
......
......@@ -11,15 +11,12 @@ uint32_t RTE_SystemCoreClock;
extern uint32_t SystemCoreClock;
void RTE_CLOCK_Select_Start(void)
{
////uint32_t msCnt;
#ifdef USED_FX_FCLK
/* config clock */
CGC_HSEConfig(OSC_OSCILLATOR,OSC_UNDER_10M);
CGC_Osc_Setting(OSC_OSCILLATOR,OSC_UNDER_10M,OSC_OSCILLATOR,OSC_NORMAL_POWER);
CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16);
CGC_PLL_CFG_AS_FCLK();
SystemCoreClockUpdate();
RTE_SystemCoreClock = SystemCoreClock;
delay_init(64000000);
SystemCoreClock = 64000000UL;
#endif
......
......@@ -15,6 +15,8 @@ void Sys_2ms_Tasks(void)
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
AMT630H_Main();
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);无外发
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp, 2u);
}
void Sys_5ms_Tasks(void)
......@@ -24,6 +26,7 @@ void Sys_5ms_Tasks(void)
void Sys_10ms_Tasks(void)
{
Line_In_Debounce_Service(10u);
Key_Service();
Key_Clear_Time();
Key_TimeOut_Service();
......@@ -38,6 +41,7 @@ void Sys_20ms_Tasks(void)
void Sys_50ms_Tasks(void)
{
Telltales_Management();
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