Commit d330e169 authored by 高士达's avatar 高士达

Merge branch 'dev' into 'gaoshida'

Dev

See merge request !17
parents e916fd30 3fa7100a
...@@ -39,3 +39,6 @@ HJ232_Source/tim4DelayCounter.uvguix.tyw05 ...@@ -39,3 +39,6 @@ HJ232_Source/tim4DelayCounter.uvguix.tyw05
HJ232_Source/Out/QJ300_circle.axf HJ232_Source/Out/QJ300_circle.axf
HJ232_Source/tim4DelayCounter.uvguix.tyw05 HJ232_Source/tim4DelayCounter.uvguix.tyw05
HJ232_Source/Out/QJ300_circle.axf HJ232_Source/Out/QJ300_circle.axf
/.vscode
/HJ232_Source/Out/*.map
/HJ232_Source/Out
This diff is collapsed.
--cpu Cortex-M0+
".\objects\gpio.o"
".\objects\wdt.o"
".\objects\sys_tick.o"
".\objects\adc.o"
".\objects\analog_circuits.o"
".\objects\analog_signals.o"
".\objects\sci.o"
".\objects\sci_user.o"
".\objects\clk.o"
".\objects\intp.o"
".\objects\intp_user.o"
".\objects\tim4.o"
".\objects\rtc.o"
".\objects\timera_b_c.o"
".\objects\can.o"
".\objects\bu98r10.o"
".\objects\seg_lcd.o"
".\objects\flash.o"
".\objects\is31fl3236.o"
".\objects\aw93015.o"
".\objects\is31_iic_master.o"
".\objects\main.o"
".\objects\tasks.o"
".\objects\sys_scheduler.o"
".\objects\init.o"
".\objects\line_in.o"
".\objects\powermanagement.o"
".\objects\powermanagement_user.o"
".\objects\system_monitor.o"
".\objects\system_monitor_user.o"
".\objects\rte_adc.o"
".\objects\common_interface.o"
".\objects\mcu_core_protocol.o"
".\objects\telltales_user.o"
".\objects\flash_synchronizer.o"
".\objects\calcfrequency_user.o"
".\objects\fuel.o"
".\source\Application\Eeprom\eepromManage.lib"
".\objects\eemanager_interface.o"
".\objects\services_mileage_user.o"
".\objects\data_gear.o"
".\objects\backgroundlight.o"
".\objects\bglinterface.o"
".\objects\key.o"
".\objects\menus.o"
".\objects\can_communication_matrix.o"
".\source\Application\APPCan\CAN_Lib.lib"
".\objects\can_user.o"
".\objects\gauges.o"
".\objects\coolanttemp.o"
".\source\Application\CalcFrequency\CalcFrequency.lib"
".\objects\app_telltales.o"
".\source\Application\Telltales\Telltales.lib"
".\objects\app_service.o"
".\objects\app_serviceproc.o"
".\objects\link_layer.o"
".\objects\tp_layer.o"
".\objects\u2_app_service.o"
".\objects\u2_app_serviceproc.o"
".\objects\u2_link_layer.o"
".\objects\u2_tp_layer.o"
".\objects\isr_bat32a239.o"
".\objects\startup_bat32a239.o"
".\objects\system_bat32a239.o"
--strict --scatter ".\Objects\..\Out\QJ300_circle.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers
--list ".\Listings\..\Out\QJ300_circle.map" -o .\Objects\..\Out\QJ300_circle.axf
\ No newline at end of file
This diff is collapsed.
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00008000 { ; RW data
.ANY (+RW +ZI)
}
}
#include "CAN_Communication_Matrix.h" #include "CAN_Communication_Matrix.h"
#include "CAN_User.h" #include "CAN_User.h"
#include "Menus.h"
/* 2022/01/19 15:02:57 */ /* 2022/01/19 15:02:57 */
const st_CAN_SendAttribute st_CANSendAttr[ID_SEND_TOTAL] = const st_CAN_SendAttribute st_CANSendAttr[ID_SEND_TOTAL] =
...@@ -12,7 +12,7 @@ const st_CAN_SendAttribute st_CANSendAttr[ID_SEND_TOTAL] = ...@@ -12,7 +12,7 @@ const st_CAN_SendAttribute st_CANSendAttr[ID_SEND_TOTAL] =
{0x510ul, 18ul * 1000ul, 17ul, 0u, MSG_STD, 6u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_510}, {0x510ul, 18ul * 1000ul, 17ul, 0u, MSG_STD, 6u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_510},
{0x450ul, 98ul * 1000ul, 23ul, 0u, MSG_STD, 7u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450}, {0x450ul, 98ul * 1000ul, 23ul, 0u, MSG_STD, 7u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450},
{0x515ul, 48ul * 1000ul, 29ul, 0u, MSG_STD, 7u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_515}, {0x515ul, 48ul * 1000ul, 29ul, 0u, MSG_STD, 7u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_515},
//{0x502ul, 98ul * 1000ul, 48ul, 0u, MSG_STD, 8u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_502},//̥ѹԤ //{0x502ul, 98ul * 1000ul, 48ul, 0u, MSG_STD, 8u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_502},//̥ѹ���Ԥ��
}; };
const st_CANMsgAttribute CAN_MSG_CONST_ARRAY[ID_TOTAL_MAX] = const st_CANMsgAttribute CAN_MSG_CONST_ARRAY[ID_TOTAL_MAX] =
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
#include "U2_uds_includes.h" #include "U2_uds_includes.h"
#include <string.h> #include <string.h>
#include "PowerManagement_user.h" #include "PowerManagement_user.h"
#include "Data_Gear.h"
#include "Common_Interface.h" #include "Common_Interface.h"
#include "Menus.h"
#include "BGLInterface.h"
#include "Fuel.h" #include "Fuel.h"
#include "Telltales_user.h" #include "Telltales_user.h"
#include "CoolantTemp.h"
#include "MCU_Core_Protocol.h"
#include "Services_Mileage_User.h" #include "Services_Mileage_User.h"
#include "U2_app_Service.h" #include "U2_app_Service.h"
#include "System_Monitor.h" #include "System_Monitor.h"
...@@ -137,11 +137,7 @@ void Can_Set_Buff_510(uint8_t CopyData[]) ...@@ -137,11 +137,7 @@ void Can_Set_Buff_510(uint8_t CopyData[])
CopyData[0] = Get_CurFuelSetp(); CopyData[0] = Get_CurFuelSetp();
} }
CopyData[1] |= (Line_In_Get_Status(LINE_IN_HighBeam) & 0x01) << 7;
CopyData[1] |= (Line_In_Get_Status(LINE_IN_LeftTurn) & 0x01) << 6;
CopyData[1] |= (Line_In_Get_Status(LINE_IN_RightTurn) & 0x01) << 5;
CopyData[1] |= (Line_In_Get_Status(LINE_IN_OilPressure) & 0x01) << 4;
CopyData[1] |= (Line_In_Get_Status(LINE_IN_OBD) & 0x01) << 3;
temp16 = FuelR/10; temp16 = FuelR/10;
if(FuelR>3100){ if(FuelR>3100){
...@@ -150,7 +146,7 @@ void Can_Set_Buff_510(uint8_t CopyData[]) ...@@ -150,7 +146,7 @@ void Can_Set_Buff_510(uint8_t CopyData[])
CopyData[2] = (temp16>>8)&0xff; CopyData[2] = (temp16>>8)&0xff;
CopyData[3] = temp16&0xff; CopyData[3] = temp16&0xff;
CopyData[4] |= (Line_In_Get_Status(LINE_IN_ABS) & 0x01) << 7;
} }
void Can_Set_Buff_523(uint8_t CopyData[]) void Can_Set_Buff_523(uint8_t CopyData[])
...@@ -199,14 +195,7 @@ void Can_Set_Buff_450(uint8_t CopyData[]) ...@@ -199,14 +195,7 @@ void Can_Set_Buff_450(uint8_t CopyData[])
CopyData[7] = 0u; /* 8 */ CopyData[7] = 0u; /* 8 */
if (Get_TCS_Status() == 0)
{
temp8 = 1;
}
else
{
temp8 = 0;
}
CopyData[1] = temp8 & 0x0f; CopyData[1] = temp8 & 0x0f;
...@@ -226,23 +215,7 @@ void Can_Set_Buff_515(uint8_t CopyData[]) ...@@ -226,23 +215,7 @@ void Can_Set_Buff_515(uint8_t CopyData[])
GetAllDtcFault(CurFault, &CurFaultNum, HisFault, &HisFaultNum); GetAllDtcFault(CurFault, &CurFaultNum, HisFault, &HisFaultNum);
if ( CurFaultNum )
{
tempFaultCode = 0x00000000;
for ( uint8_t i = 0; i < CurFaultNum; i++ )
{
temp32 = CurFault[ i ];
if ( 0x01170000 == ( temp32 & 0xFFFF0000 ) )
{ tempFaultCode = 0x00000117; }
else if ( 0x01180000 == ( temp32 & 0xFFFF0000 ) )
{ tempFaultCode = 0x00000118; }
else
{ ; }
}
}
else
{ tempFaultCode = 0x00000000; }
...@@ -262,23 +235,7 @@ void Can_Set_Buff_515(uint8_t CopyData[]) ...@@ -262,23 +235,7 @@ void Can_Set_Buff_515(uint8_t CopyData[])
CopyData[3] = 0u; /* 4 */ CopyData[3] = 0u; /* 4 */
// bcm_module_temp = Get_Bcm_Module();
// if(bcm_module_temp == BCM_DELFU){
// if(Get_CoolantTemp_Signal_Connect()){
// SendTempValue = get_CoolantTempVal();
// }
// else{
// SendTempValue = 215;
// }
// }
// else if(bcm_module_temp == BCM_LIANDIAN){
// /*if(CAN_SIG_NORMAL == CAN_MSG_Status(ID_ECU_Engine_Data_M2_Msg_Count)){
// SendTempValue = get_CoolantTempVal();
// }
// else{
// SendTempValue = 215;
// } */
// }
SendTempValue = get_CoolantTempVal(); SendTempValue = get_CoolantTempVal();
if(SendTempValue >= (-40)){ if(SendTempValue >= (-40)){
...@@ -421,7 +378,7 @@ void Can_Set_Buff_502(uint8_t CopyData[]) ...@@ -421,7 +378,7 @@ void Can_Set_Buff_502(uint8_t CopyData[])
CopyData[6] = 0U; CopyData[6] = 0U;
CopyData[7] = 0U; CopyData[7] = 0U;
temp8 = LINE_IN_Get_TirePressure();
CopyData[0] = temp8 << 2; CopyData[0] = temp8 << 2;
...@@ -1356,10 +1313,7 @@ uint8_t TCS_WorkModeFlsh = 0; ...@@ -1356,10 +1313,7 @@ uint8_t TCS_WorkModeFlsh = 0;
uint16_t Get_TCS_WorkModeFlash(void) uint16_t Get_TCS_WorkModeFlash(void)
{ {
if ((Get_ID_125_Sig_TCS_WorkMode() == 1) || (Get_TCS_Status() == 0))
{
TCS_WorkModeFlsh = 1;
}
return TCS_WorkModeFlsh; return TCS_WorkModeFlsh;
} }
......
#ifndef _BGLINTERFACE_H
#define _BGLINTERFACE_H
#include "common.h"
/*#define uint8_t unsigned char*/
/*#define uint16_t unsigned short*//*3360 324*/
/*#define uint16_t unsigned int*/ /*Freesecale */
/*#define uint32_t unsigned long*//*Freesecale */
/*#define uint32_t unsigned int*/
#define COLOR_LED_DEBUG 0u
/*占空比最大值*/
#define BACKLIGHTCYCLE 721u
#define NTC_AD_MAX 4096u
/*有小灯背光降到当前显示等级的百分比*/
#define POSITION_LIGHT_PERCENT 70u
/*自动调节背光参数*/
#define CHANGE_TO_NIGHT_MODE_VALUE 721u
#define CHANGE_TO_DAY_MODE_VALUE 1500u
#define BG_Debounce_Time_Ms 200u
#define Light_Buffer_Size 20u
#define BG_Auto_Mode_Min_Light 80u
#define BG_Auto_Mode_Min_Duty 400u
#define BG_Auto_Mode_Max_Light 2000u
#define BG_Auto_Mode_Max_Duty 950u
typedef enum _dayOrNight
{
_DAY = 0, //白天模式
_NIGHT
}dayOrNight_E;
enum {
TIMERBIO0,
};
enum {
BGL_IGN_OFF,
BGL_IGN_ON,
};
enum {
BGL_GRADUAL,
BGL_DIRECT,
};
enum {
BL_TYPE_DAY,
BL_TYPE_EVENING,
BL_TYPE_NIGHT,
BL_TYPE_TOTAL,
};
enum {
BL_THEME_RED,
BL_THEME_BLUE,
BL_THEME_WHITE,
BL_THEME_TOTAL,
};
enum {
BL_LV_MIN = 0,
BL_LV_1,
BL_LV_2,
BL_LV_3,
BL_LV_4,
BL_LV_5,
BL_LV_6,
BL_LV_7,
BL_LV_8,
BL_LV_9,
BL_LV_10,
BL_LV_MAX,
BL_LV_TOTAL,
BL_LV_AUTO = 0xFE,
};
enum {
BL_TFT,
BL_DIAL,
BL_R,
BL_G,
BL_B,
BACKLIGHT_TOTAL,
};
typedef struct {
uint16_t DestBackLightDuty;
uint16_t CurBackLightDuty;
uint16_t BackLightDutyMin;
}BACKLIGHT_PARA;
typedef struct {
uint8_t BL_User_PowerSt;
uint8_t BL_User_WakeFlag;
uint16_t BL_User_TFTDuty;
uint16_t BL_User_GaugesDuty;
uint16_t BL_User_RDuty;
uint16_t BL_User_GDuty;
uint16_t BL_User_BDuty;
uint16_t BL_User_TFTDuty_MIN;
uint16_t BL_User_GaugesDuty_MIN;
uint16_t BL_User_RDuty_MIN;
uint16_t BL_User_GDuty_MIN;
uint16_t BL_User_BDuty_MIN;
}BL_USER_PARA;
typedef struct {
uint8_t BL_User_Mode;
uint8_t BL_User_Theme;
uint8_t BL_User_Type;
uint8_t BL_User_TFTLvl;
uint8_t BL_User_DIALLvl;
uint8_t BL_User_RGBLvl;
uint8_t BL_User_Lvl_Total;
uint16_t BL_User_NTC_AD;
uint16_t BL_User_NTC_AD_MAX;
uint8_t BL_User_effect;
}BL_STATE_PARA;
typedef struct {
uint8_t BL_TFT_Lvl;
uint8_t BL_DIAL_Lvl;
uint8_t BL_RGB_Lvl;
}BL_Lvl_PARA;
extern void BGLPwm_Config(uint8_t BGLType, uint16_t DutyVal);
extern void BackLightDeal(BL_USER_PARA BL_FunPara,BL_STATE_PARA BLFunStatePara);
extern void BGLPwm_Stop(uint8_t BGLType);
extern void BGLPwm_Start(uint8_t BGLType);
/*以下主函数调用*/
/*得到主题模式可自己在枚举中定义 在BackGroundLight.c里填表*/
extern void SetBGLTheme(uint8_t BGLTheme);
/*得到工作模式 白天 傍晚 夜晚 在枚举中已定义*/
extern void SetBGLType(uint8_t BGLType);
/*得到背光等级 可自己在枚举中定义 在BackGroundLight.c里填表*/
extern void SetBGLLvl(BL_Lvl_PARA BGLLvl, uint8_t FunPositionLight);
/*小灯暗级处理*/
uint8_t ProcessLittleLight(uint8_t BGLLvl);
/*得到热敏电阻电压参数为100倍电压值*/
extern void GetBGLNTCVol(uint16_t BGLNTCVol);
/*主函数中调用第一个参数电源状态 1是 ON档 2 off 第二个参数 唤醒条件 1是TTF唤醒 2 是表盘唤醒 3 是表盘和屏都有唤醒,0无唤醒*/
extern void BackLightSchedu(uint8_t BGLPowerSt,uint8_t WakeFlag);
/*定时函数中调用 1ms函数中调用 TimeX 填1u*/
extern void BackLightDamp(uint8_t TimeX);
extern dayOrNight_E Get_Day_Or_Night(void);
/*调试用*/
#if COLOR_LED_DEBUG
extern void DebugBGLPara(void);
extern void SetTFTDebugPara(uint16_t TestTFTDuty);
extern void SetGaugesDebugPara(uint16_t TestGaugesDuty);
extern void SetRDebugPara(uint16_t TestRDuty);
extern void SetGDebugPara(uint16_t TestGDuty);
extern void SetBDebugPara(uint16_t TestBDuty);
#endif
/**用户自定义函数**/
/*背光任务*/
extern void BGTask(void);
/*陕汽M3000背光等级出来函数*/
extern uint8_t BL_Logic_Get_Lv(void);
#endif
#ifndef _BACKGROUND_LIGHT_H
#define _BACKGROUND_LIGHT_H
#include "BGLInterface.h"
#define IGN_ON_BACK_LIGHT_DELAY_MS 10u
#define IGN_OFF_BACK_LIGHT_DELAY_MS 0u
#define BACKLIGHT_LV100 0u
#define BACKLIGHT_LV80 1u
#define BACKLIGHT_LV40 2u
extern void SetBackLightOutput(uint8_t n, uint16_t val);
extern void SetBacklightDestVal(uint8_t n, const uint16_t val);
extern void SetBacklightCurVal(uint8_t n, uint16_t val);
extern void SetBacklightMinVal(uint8_t n, uint16_t val);
extern void BackLightDamp(uint8_t TimeX);
extern void BackLightDeal(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara);
extern void SetBacklightMinVal(uint8_t n, uint16_t val);
/*TFT高温处理函数*/
extern void BackLightDeal_NTC(BL_USER_PARA BL_FunPara, BL_STATE_PARA BLFunStatePara);
extern void AD_SwapShort(uint16_t *pData1, uint16_t *pData2);
extern void AD_SortShort(uint16_t SortData[], uint8_t len);
extern uint16_t Calculate_Thermistor(BL_STATE_PARA BLFunStatePara);
#endif
/*
* bsp_clock.h
*
* Created on: 2021
* Author: QTC
*/
#ifndef _CALCFREQ_H_
#define _CALCFREQ_H_
#include "common.h"
#include "CalcFrequency.h"
/*-------------------------------------------------------------------------
* Function Name : RevFreInit
* Description : 转速频率初始化函数
* Input : MaxFreq:转速最大频率,单位Hz
TIMn_Clock:频率捕捉计数频率,单位Hz
SpeedRadio:转速速比
转速 x 速比
转速速比计算方式: 频率 = ————————————————————————
60
* Output : None
* Return : None
* onther : 30电初始化一次
--------------------------------------------------------------------------*/
extern void RevFreInit(uint32_t MaxFreq,uint32_t TIMn_Clock,uint32_t SpeedRadio);
/*-------------------------------------------------------------------------
* Function Name : InputRevLowPulseTime
* Description : 输入转速脉冲低电平时间
* Input : TIMn_TCx:时间计数。TIM_overFlag:是否发生溢出
* Output : None
* Return : None
* onther : 捕获中断中调用
--------------------------------------------------------------------------*/
extern void InputRevLowPulseTime(uint16_t* TIMn_TCx,uint16_t* TIM_overFlag);
/*-------------------------------------------------------------------------
* Function Name : InputRevHighPulseTime
* Description : 输入转速脉冲高电平时间
* Input : TIMn_TCx:时间计数。TIM_overFlag:是否发生溢出
* Output : None
* Return : None
* onther : 捕获中断中调用
--------------------------------------------------------------------------*/
extern void InputRevHighPulseTime(uint16_t* TIMn_TCx,uint16_t* TIM_overFlag);
/*-------------------------------------------------------------------------
* Function Name : CalcRevFreqService
* Description : 计算转速频率服务函数
* Input : deltaTime:函数调用周期时间,仅计算超时使用,时间要求不严格
* Output : None
* Return : None
* onther : 建议放在100ms周期任务中
--------------------------------------------------------------------------*/
extern void CalcRevFreqService(uint16_t deltaTime);
/*-------------------------------------------------------------------------
* Function Name : Get_Rev_Speed
* Description : 获取真实转速
* Input : None
* Output : 转速值
* Return : None
* onther :
--------------------------------------------------------------------------*/
uint16_t Get_Rev_Speed(void);
/*-------------------------------------------------------------------------
* Function Name : VehFreInit
* Description : 车速频率初始化函数
* Input : MaxSpeed:最大车速,单位km/h
TIMn_Clock:频率捕捉计数频率,单位Hz
SpeedRadio:转速速比
车速 x PPK
车速PPK计算方式: 频率 = ————————————————————————
3600
* Output : None
* Return : None
* onther : 30电初始化一次
--------------------------------------------------------------------------*/
void VehFreInit(uint32_t MaxSpeed,uint32_t TIMn_Clock,uint32_t PPK);
/*-------------------------------------------------------------------------
* Function Name : CalcVehFreqService
* Description : 计算车速频率服务函数
* Input : deltaTime:函数调用周期时间,仅计算超时使用,时间要求不严格
* Output : None
* Return : None
* onther : 建议放在100ms周期任务中
--------------------------------------------------------------------------*/
void CalcVehFreqService(uint16_t deltaTime);
/*-------------------------------------------------------------------------
* Function Name : InputVehLowPulseTime
* Description : 输入车速脉冲低电平时间
* Input : TIMn_TCx:时间计数。TIM_overFlag:是否发生溢出
* Output : None
* Return : None
* onther : 捕获中断中调用
--------------------------------------------------------------------------*/
void InputVehLowPulseTime(uint16_t* TIMn_TCx,uint16_t* TIM_overFlag);
/*-------------------------------------------------------------------------
* Function Name : InputVehHighPulseTime
* Description : 输入车速脉冲高电平时间
* Input : TIMn_TCx:时间计数。TIM_overFlag:是否发生溢出
* Output : None
* Return : None
* onther : 捕获中断中调用
--------------------------------------------------------------------------*/
void InputVehHighPulseTime(uint16_t* TIMn_TCx,uint16_t* TIM_overFlag);
/*-------------------------------------------------------------------------
* Function Name : Get_Veh_Speed
* Description : 获取真实车速
* Input : None
* Output : 车速值
* Return : None
* onther :
--------------------------------------------------------------------------*/
uint16_t Get_Veh_Speed(void);
/*-----------user code --------------------*/
void CalcFreqData(uint16_t deltaTime);
void CalcFreq_KL15_Init(void);
#endif /* _CALCFREQ_H_ */
#include "CalcFrequency.h"
#include "Common_Interface.h"
#include "tim4.h"
#include "MCU_Core_Protocol.h"
#include "CAN_Communication_Matrix.h"
//static uint16_t VehSpeedBuf[3];
//static uint8_t VehSpeedCount;
void CalcFreq_KL15_Init(void)
{
// E_Speed_Dir = E_SPEED_SEG_UP;
// EspeedBak = 0;
// E_Speed_Current_Bar = 0;
// CurEspeed = 0;
// DesEspeed = 0;
// VehSpeedBuf[0] = 0;
// VehSpeedBuf[1] = 0;
// VehSpeedBuf[2] = 0;
// VehSpeedCount = 0;
Capture_Init(40u);
RevFreInit(200u, 500000u, 1u);
//Capture_Init(40u);
//VehFreInit(360u, 500000u, 23616u); // 23637u); //20230602;
}
uint16_t DisVehDelay = 0;
void CalcFreqData(uint16_t deltaTime)
{
uint16_t RevSpeed = 0;
uint16_t VehSpeed = 0;
uint16_t DispVehSpeed = 0;
uint16_t RearVeh = 0;
uint16_t DispRearVeh = 0;
uint32_t temp32 = 0;
uint8_t Valid = 0;
CalcRevFreqService(deltaTime);
/*转�??*/
RevSpeed = Get_Rev_Speed();
if (RevSpeed > 18000)
{ /*输入频率大于300Hz,转速显�?0*/
RevSpeed = 0;
}
else if (RevSpeed > 12000)
{
RevSpeed = 12000;
}
if ((RevSpeed < 12100) && (Common_GetIgnOnTime() > IGON_SelfcheckingTimer))
{ /*输入频率大于200HZ(小�?300HZ)时,保持当前�?�显示�??*/
Common_Set_Act_E_Speed(RevSpeed);
Common_Set_Act_E_Speed_Valid(COMMON_Valid);
Common_Set_Disp_E_Speed(RevSpeed);
Common_Set_Disp_E_Speed_Valid(COMMON_Valid);
}
temp32 = Get_ID_12B_Rear_Speed();
temp32 *= 5625;
temp32 /= 10000;
Valid = Get_ID_12B_Rear_Wheel_Speed_Validity();
if ((Valid == 1) || (temp32 < 30) || (CAN_SIG_LOST == CAN_MSG_Status(ID_ABS_12B_Count)))
{
VehSpeed = 0;
DispVehSpeed = 0;
}
else
{
VehSpeed = temp32;
DispVehSpeed = temp32 * 108 / 10;
if (DispVehSpeed > 1990)
{
DispVehSpeed = 1990;
}
}
Common_Set_Act_V_Speed(VehSpeed);
Common_Set_Act_V_Speed_Valid(COMMON_Valid);
DisVehDelay += deltaTime;
if(DisVehDelay >= 200){
DisVehDelay = 0;
DispVehSpeed = ((uint32_t)VehSpeed*108)/100;
if(DispVehSpeed > 1990){
DispVehSpeed = 1990;
}
Common_Set_Disp_V_Speed(DispVehSpeed);
Common_Set_Disp_V_Speed_Valid(COMMON_Valid);
}
}
#include "CoolantTemp.h"
#include "Flash_synchronizer.h"
#include "Common_Interface.h"
#include "CAN_User.h"
#include "CAN_Communication_Matrix.h"
#define COOLANT_TEMP_RETURN_DIFFERENCE 3 //80u /*判断上升或下降的回差,精?1*/
#define COOLANT_TEMP_SEG_UP 0u
#define COOLANT_TEMP_SEG_DOWN 1u
int16_t CoolantTempValue = 0u;
static int16_t CoolantTempValueBak = 0;
uint8_t DesCoolantTempSetp = 0u;
uint8_t CurCoolantTempSetp = 0u;
uint8_t CoolantTempInitFlag = 0u;
uint8_t CoolantTempDir = COOLANT_TEMP_SEG_UP;
CoolantTempSensorSts_t CoolantTempSensorState = CoolantTempSensorNormal;
uint16_t CoolantTempSensorNormalTime = 0u;
uint16_t CoolantTempSensorShortTime = 0u;
uint16_t CoolantTempSensorOpenTime = 0u;
static uint8_t CoolantTempAlarm = 0u;
uint16_t CoolantTemp_Signal_Time = 0;
uint8_t CoolantTemp_Signal_Connect = 0;
uint32_t tempFaultCode = 0x00000000;
void CoolantTemp_KL30_Init(void)
{
}
void CoolantTemp_KL15_Init(void)
{
DesCoolantTempSetp = 0u;
CurCoolantTempSetp = 0u;
CoolantTempInitFlag = 1u;
CoolantTempDir = COOLANT_TEMP_SEG_UP;
CoolantTempSensorState = CoolantTempSensorNormal;
CoolantTempSensorNormalTime = 0u;
CoolantTempSensorShortTime = 0u;
CoolantTempSensorOpenTime = 0u;
CoolantTempAlarm = 0;
CoolantTemp_Signal_Time = 0;
CoolantTemp_Signal_Connect = 0;
CoolantTempValue = -273;
CoolantTempValueBak = -273;
tempFaultCode = 0x00000000;
}
void CoolantTemp_State_Check(uint8_t deltaTime)
{
if(CoolantTempValue >= 135){ /*短路*/
CoolantTempSensorOpenTime = 0;
CoolantTempSensorNormalTime = 0;
if(CoolantTempSensorShortTime < 3000){
CoolantTempSensorShortTime += deltaTime;
}
else{
CoolantTempSensorState = CoolantTempSensorShortCircuit;
CurCoolantTempSetp = 0;
DesCoolantTempSetp = 0;
CoolantTempInitFlag = 1;
CoolantTempDir = COOLANT_TEMP_SEG_UP;
}
}
else if(CoolantTempValue < -30){ /*断路*/
CoolantTempSensorShortTime = 0;
CoolantTempSensorNormalTime = 0;
if(CoolantTempSensorOpenTime < 3000){
CoolantTempSensorOpenTime += deltaTime;
}
else{
CoolantTempSensorState = CoolantTempSensorOpenCircuit;
CurCoolantTempSetp = 0;
DesCoolantTempSetp = 0;
CoolantTempInitFlag = 1;
CoolantTempDir = COOLANT_TEMP_SEG_UP;
}
}
else{
CoolantTempSensorShortTime = 0;
CoolantTempSensorOpenTime = 0;
if(CoolantTempSensorNormalTime < 3000){
CoolantTempSensorNormalTime += deltaTime;
}
else{
CoolantTempSensorState = CoolantTempSensorNormal;
}
}
if(tempFaultCode == 0x00000117)
{
CoolantTempSensorState = CoolantTempSensorShortCircuit;
CoolantTempSensorShortTime = 0;
CoolantTempSensorOpenTime = 0;
CoolantTempSensorNormalTime = 3000;
}
else if(tempFaultCode == 0x00000118)
{
CoolantTempSensorState = CoolantTempSensorOpenCircuit;
CoolantTempSensorShortTime = 0;
CoolantTempSensorOpenTime = 0;
CoolantTempSensorNormalTime = 3000;
}
}
void CoolantTemp_Gauges_Cal(uint8_t deltaTime)
{
static uint16_t time = 0;
if((Get_CoolantTemp_Signal_Connect()) && (CoolantTempSensorState == CoolantTempSensorNormal) && (CoolantTempValue >= -30) && (CoolantTempValue < 135)){
if(CoolantTempInitFlag){
CoolantTempValueBak = CoolantTempValue;
}
/*根据回差计算走动方向*/
if(CoolantTempDir == COOLANT_TEMP_SEG_UP){
if(CoolantTempValue + COOLANT_TEMP_RETURN_DIFFERENCE <= CoolantTempValueBak){
CoolantTempDir = COOLANT_TEMP_SEG_DOWN;
CoolantTempValueBak = CoolantTempValue;
}
if(CoolantTempValue > CoolantTempValueBak){
CoolantTempValueBak = CoolantTempValue;
}
}
else{
if(CoolantTempValue >= CoolantTempValueBak + COOLANT_TEMP_RETURN_DIFFERENCE){
CoolantTempDir = COOLANT_TEMP_SEG_UP;
CoolantTempValueBak = CoolantTempValue;
}
if(CoolantTempValue < CoolantTempValueBak){
CoolantTempValueBak = CoolantTempValue;
}
}
/*计算目标格数*/
if(CoolantTempDir == COOLANT_TEMP_SEG_UP){
if(((DesCoolantTempSetp == 4) || (CoolantTempInitFlag)) && (CoolantTempValue >= 115)){
DesCoolantTempSetp = 5;
}
else if(((DesCoolantTempSetp == 3) || (CoolantTempInitFlag)) && (CoolantTempValue >= 100)){
DesCoolantTempSetp = 4;
}
else if(((DesCoolantTempSetp == 2) || (CoolantTempInitFlag)) && (CoolantTempValue >= 90)){
DesCoolantTempSetp = 3;
}
else if(((DesCoolantTempSetp == 1) || (CoolantTempInitFlag)) && (CoolantTempValue >= 70)){
DesCoolantTempSetp = 2;
}
else if(DesCoolantTempSetp == 0){
DesCoolantTempSetp = 1;
}
}
else if(CoolantTempDir == COOLANT_TEMP_SEG_DOWN){
if(((DesCoolantTempSetp == 2) || (CoolantTempInitFlag)) && (CoolantTempValue <= 70-COOLANT_TEMP_RETURN_DIFFERENCE)){
DesCoolantTempSetp = 1;
}
else if(((DesCoolantTempSetp == 3) || (CoolantTempInitFlag)) && (CoolantTempValue <= 90-COOLANT_TEMP_RETURN_DIFFERENCE)){
DesCoolantTempSetp = 2;
}
else if(((DesCoolantTempSetp == 4) || (CoolantTempInitFlag)) && (CoolantTempValue <= 100-COOLANT_TEMP_RETURN_DIFFERENCE)){
DesCoolantTempSetp = 3;
}
else if(((DesCoolantTempSetp == 5) || (CoolantTempInitFlag)) && (CoolantTempValue <= 115-COOLANT_TEMP_RETURN_DIFFERENCE)){
DesCoolantTempSetp = 4;
}
}
/*IGN ON 1秒后,开始走?*/
if(Common_GetIgnOnTime() >= 1000){
time += deltaTime;
if(CoolantTempInitFlag){
CoolantTempInitFlag = 0;
time = 0;
CurCoolantTempSetp = DesCoolantTempSetp;
}
if(time >= 5000){
time = 0;
if(CurCoolantTempSetp < DesCoolantTempSetp){
CurCoolantTempSetp ++;
}
else if(CurCoolantTempSetp > DesCoolantTempSetp){
CurCoolantTempSetp --;
}
}
if(CurCoolantTempSetp == DesCoolantTempSetp){
time = 0;
}
}
}
if (Get_CoolantTemp_Signal_Connect() == 0)
{
CoolantTempAlarm = 0;
CoolantTempSensorState = CoolantTempSensorNormal;
CoolantTempSensorOpenTime = 0;
CoolantTempSensorShortTime = 0;
CoolantTempValue = -50;
CoolantTempValueBak = -50;
CoolantTempInitFlag = 1;
CurCoolantTempSetp = 0;
DesCoolantTempSetp = 0;
CoolantTempDir = COOLANT_TEMP_SEG_UP;
}
else
{
if (CurCoolantTempSetp == 5)
{
CoolantTempAlarm = 1;
}
else
{
CoolantTempAlarm = 0;
}
}
}
void CoolantTemp_Cal_Sevice(uint8_t deltaTime)
{
CoolantTempValue = get_CoolantTempVal();
/*?测水温传感器状??*/
CoolantTemp_State_Check(deltaTime);
/*显示水温?*/
CoolantTemp_Gauges_Cal(deltaTime);
}
uint8_t Get_CoolantTemp_Step(void)
{
return CurCoolantTempSetp;
}
int16_t Get_CoolantTempValue(void)
{
return CoolantTempValue;
}
CoolantTempSensorSts_t Get_CoolantTemp_Sensor_State(void)
{
return CoolantTempSensorState;
}
uint8_t Get_CoolantTemp_Disp_Byte(void)
{
uint8_t CoolantTempDispByte = 0u;
CoolantTempDispByte = CurCoolantTempSetp;
if (CoolantTempSensorState == CoolantTempSensorShortCircuit)
{
//Shot
CoolantTempDispByte = FLASH_SYNC_1Hz ? 9 : 0;
}
else if (CoolantTempSensorState == CoolantTempSensorOpenCircuit)
{
//Open
CoolantTempDispByte = FLASH_SYNC_1Hz ? 8 : 0;
}
if (CoolantTemp_Signal_Connect == 0)
{
//CanErr
CoolantTempDispByte = FLASH_SYNC_1Hz ? 7 : 6;
}
if (CoolantTempDispByte == 5)
{
CoolantTempDispByte = FLASH_SYNC_1Hz ? 5 : 0;
}
if (Get_ID_101_ECU_Engine_Temperature_State() == 1)
{
CoolantTempDispByte = FLASH_SYNC_1Hz ? 8 : 0;
}
return CoolantTempDispByte;
}
uint8_t Get_CoolantTemp_Alarm(void)
{
return CoolantTempAlarm;
}
void CoolantTemp_Signal_Time_Service(uint8_t deltaTime)
{
/*_BCM_Module bcm_module_temp;
bcm_module_temp = Get_Bcm_Module();
if(bcm_module_temp == BCM_DELFU){
CoolantTemp_Signal_Time += deltaTime;
if(CoolantTemp_Signal_Time > 3000){ //3秒超?
CoolantTemp_Signal_Connect = 0;
}
}
else if(bcm_module_temp == BCM_LIANDIAN){
if(CAN_SIG_NORMAL == CAN_MSG_Status(ID_ECU_Count)){
CoolantTemp_Signal_Connect = 1;
}
else{
CoolantTemp_Signal_Connect = 0;
}
}*/
if(CAN_SIG_NORMAL == CAN_MSG_Status(ID_ECU_Count))
{
CoolantTemp_Signal_Connect = 1;
}
else
{
CoolantTemp_Signal_Connect = 0;
}
}
void Reset_CoolantTemp_Signal_Time(void)
{
CoolantTemp_Signal_Time = 0;
CoolantTemp_Signal_Connect = 1;
}
uint8_t Get_CoolantTemp_Signal_Connect(void)
{
return CoolantTemp_Signal_Connect;
}
#ifndef COOLANT_TEMP_H
#define COOLANT_TEMP_H
#include "common.h"
typedef enum{
CoolantTempSensorNormal = 0,
CoolantTempSensorShortCircuit,
CoolantTempSensorOpenCircuit,
}CoolantTempSensorSts_t;
extern uint32_t tempFaultCode;
extern void CoolantTemp_KL15_Init(void);
extern void CoolantTemp_KL30_Init(void);
extern void CoolantTemp_Cal_Sevice(uint8_t deltaTime);
extern uint8_t Get_CoolantTemp_Step(void);
extern CoolantTempSensorSts_t Get_CoolantTemp_Sensor_State(void);
extern uint8_t Get_CoolantTemp_Disp_Byte(void);
extern uint8_t Get_CoolantTemp_Alarm(void);
extern int16_t Get_CoolantTempValue(void);
extern void Reset_CoolantTemp_Signal_Time(void);
extern uint8_t Get_CoolantTemp_Signal_Connect(void);
extern void CoolantTemp_Signal_Time_Service(uint8_t deltaTime);
#endif
#include "Data_Gear.h"
#include "Line_in.h"
#include "Analog_Circuits.h"
#include "Analog_Signals.h"
#include "gpio.h"
static DATA_GEAR_VALUE Gear_Number = DIS_DATA_GEAR_UNKNOW;
/******************************************************************************
Function:Data_Gear_KL30_Init
Description:该服务函数首次KL30时调用一次
Input:
Output:
******************************************************************************/
void Data_Gear_KL30_Init(void)
{
}
/******************************************************************************
Function:Data_Gear_KL15_Init
Description:该服务函数首次KL15时调用一次
Input:
Output:
******************************************************************************/
void Data_Gear_KL15_Init(void)
{
Gear_Number = DIS_DATA_GEAR_UNKNOW;
}
/******************************************************************************
Function:Data_Service_Gear_Processing
Description:如果有特殊数据处理在此函数中进行处理
Input:
Output:
******************************************************************************/
_DATA_GEAR_AD_VALUE GEAR_AD_VALUE;
static const uint16_t GEAR_ADResultMIN[7]={4100, 3750, 3300, 2500, 1900, 1200, 500 };
static const uint16_t GEAR_ADResultMAM[7]={4500, 4000, 3650, 3100, 2300, 1700, 1000};
void Data_Service_Gear_Processing(void)
{
static uint8_t timeCount = 0;
uint8_t i ,j, position,activesum;
uint16_t temp8 ;
uint16_t GEARADResult[6] ;
GEAR_AD_VALUE.DATA_GEAR_Non++; //滚动纪录数据
if(GEAR_AD_VALUE.DATA_GEAR_Non>=6) GEAR_AD_VALUE.DATA_GEAR_Non = 0 ;
//GEAR_AD_VALUE.DATA_GEAR_ADResult[GEAR_AD_VALUE.DATA_GEAR_Non] = ADC_Read_Signal(ADC_CH_GEAR);
for (i = 0; i < 6; i++) //取值
{
GEARADResult[i] = GEAR_AD_VALUE.DATA_GEAR_ADResult[i];
}
for (i = 0; i < 6-1; i++) //冒泡排序
{
for (j = 0; j < 6-1-i; j++)
{
if(GEARADResult[j] > GEARADResult[j+1])
{
temp8 = GEARADResult[j] ;
GEARADResult[j] =GEARADResult[j+1];
GEARADResult[j+1] = temp8 ;
}
}
}
temp8 = 0;
for (i = 1; i < 5; i++) //求和
{
temp8 += GEARADResult[i] ;
}
temp8 >>= 2; //平均值
i=0; position = 0 ; //档位定位, 7组档位1-6、N
while(i < 7)
{
if(temp8 >= GEAR_ADResultMIN[i])
{
position = i ;
i=7;
}
i++ ;
}
activesum = 0;
for (i = 1; i < 5; i++) //中间4个数据,在一个档位范围内有效
{
if((GEARADResult[i] >= GEAR_ADResultMIN[position]) &&(GEARADResult[i] <= GEAR_ADResultMAM[position]))
activesum ++;
}
if((temp8 >= GEAR_ADResultMIN[0])&&(temp8 <= GEAR_ADResultMAM[0])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_1;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[1])&&(temp8 <= GEAR_ADResultMAM[1])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_N;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[2])&&(temp8 <= GEAR_ADResultMAM[2])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_2;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[3])&&(temp8 <= GEAR_ADResultMAM[3])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_3;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[4])&&(temp8 <= GEAR_ADResultMAM[4])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_4;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[5])&&(temp8 <= GEAR_ADResultMAM[5])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_5;
timeCount = 0;
}
else if((temp8 >= GEAR_ADResultMIN[6])&&(temp8 <= GEAR_ADResultMAM[6])&&(activesum >=4)){
Gear_Number = DIS_DATA_GEAR_6;
timeCount = 0;
}
else{
if(timeCount > 20){
Gear_Number = DIS_DATA_GEAR_UNKNOW;
}
else{
timeCount++;
}
}
}
/******************************************************************************
Function:Get_Gear_Mode_Number
Description:Get Gear 1/2/3/4/...
Input:
Output: 1/2/3/4/...
******************************************************************************/
uint8_t Get_Gear_Mode_Number(void)
{
return (uint8_t)Gear_Number;
}
#ifndef DATA_GEAR_H
#define DATA_GEAR_H
#include "common.h"
typedef enum
{
DIS_DATA_GEAR_Non = 0,
DIS_DATA_GEAR_1,
DIS_DATA_GEAR_2,
DIS_DATA_GEAR_3,
DIS_DATA_GEAR_4,
DIS_DATA_GEAR_5,
DIS_DATA_GEAR_6,
DIS_DATA_GEAR_7,
DIS_DATA_GEAR_8,
DIS_DATA_GEAR_N,
DIS_DATA_GEAR_D,
DIS_DATA_GEAR_UNKNOW,
} DATA_GEAR_VALUE;
typedef struct
{
uint8_t DATA_GEAR_Non;
uint16_t DATA_GEAR_ADResult[10];
// uint16_t DATA_GEAR_ValueMax;
// uint16_t DATA_GEAR_ValueMin;
// uint16_t DATA_GEAR_ValueAverage;
} _DATA_GEAR_AD_VALUE;
void Data_Gear_KL30_Init(void);
void Data_Gear_KL15_Init(void);
void Data_Service_Gear_Processing(void);
uint8_t Get_Gear_Mode_Number(void);
#endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "Analog_Signals.h" #include "Analog_Signals.h"
#include "Common_Interface.h" #include "Common_Interface.h"
#include "Flash_synchronizer.h" #include "Flash_synchronizer.h"
#include "MCU_Core_Protocol.h"
#define FUEL_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/ #define FUEL_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/
#define FUEL_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/ #define FUEL_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/
...@@ -238,7 +238,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime) ...@@ -238,7 +238,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
} }
/*IGN ON 1秒/故障恢复后,开始走格 立即指向当前格 20220704*/ /*IGN ON 1秒/故障恢复后,开始走格 立即指向当前格 20220704*/
if(Common_GetIgnOnTime() >= IGON_SelfcheckingTimer){ if(Common_GetIgnOnTime() >= 3000ul){
time += deltaTime; time += deltaTime;
if(FuelInitFlag){ if(FuelInitFlag){
FuelInitFlag = 0; FuelInitFlag = 0;
......
#include "Gauges.h"
#include "Common_Interface.h"
typedef struct
{
uint32_t SelfDir;
uint32_t VehicleTestValue;
uint32_t EngineTestValue;
uint32_t FuelTestValue;
uint32_t TempTestValue;
}SelfTestTime;
SelfTestTime MotorSelfTestTime;
GaugesCtrlStruct GaugesCtrl;
//20Ms
/*void Gauges_Management_Service(void)
{
uint16_t DATA_ENGINE_SPEED_DISPLAYING;
if (Common_Get_IG_Sts() == COMMON_POWER_OFF)
{
SEG_LCD_Vehicle_Speed_Num_Display(0, 0, 0);
SEG_LCD_Engine_Speed_Seg_Display(0, 0, 0);
SEG_LCD_ODO_Trip_Display(0, 0, 0, 0);
SEG_Fuel_Level_Display(0, 0);
SEG_LCD_Battery_Voltage_Display(0, 0 ,0);
SEG_Coolant_Temp_Display(0, 0);
SEG_LCD_Gear_Display(0, 0, 0);
MotorSelfTestTime.VehicleTestValue = 0;
MotorSelfTestTime.EngineTestValue = 0;
MotorSelfTestTime.FuelTestValue = 0;
MotorSelfTestTime.TempTestValue = 0;
MotorSelfTestTime.SelfDir = 0;
}
//else if (Common_GetIgnOnTime() < 3000)
if(0) //取消扫表
{
if (MotorSelfTestTime.SelfDir >= 15) //顶格停留15*20ms=0.3s
{
if (MotorSelfTestTime.EngineTestValue < 200) //1.2s
MotorSelfTestTime.EngineTestValue = 0;
else
MotorSelfTestTime.EngineTestValue -= 210;
if (MotorSelfTestTime.VehicleTestValue < 60) //1.2s
MotorSelfTestTime.VehicleTestValue = 0;
else
MotorSelfTestTime.VehicleTestValue -= 30;
if (MotorSelfTestTime.FuelTestValue < 100) //1.2s
MotorSelfTestTime.FuelTestValue = 0;
else
MotorSelfTestTime.FuelTestValue -= 10;
if (MotorSelfTestTime.TempTestValue < 100) //1.2s
MotorSelfTestTime.TempTestValue = 0;
else
MotorSelfTestTime.TempTestValue -= 10;
}
else
{
if ((MotorSelfTestTime.EngineTestValue >= 12600) && (MotorSelfTestTime.VehicleTestValue >= 1990) &&\
(MotorSelfTestTime.FuelTestValue >= 600) && (MotorSelfTestTime.FuelTestValue >= 600))
{
MotorSelfTestTime.SelfDir ++;
}
else
{
MotorSelfTestTime.EngineTestValue += 168; //1.5s
MotorSelfTestTime.VehicleTestValue += 24; //1.5s
MotorSelfTestTime.FuelTestValue += 8; //1.5s
MotorSelfTestTime.TempTestValue += 8; //1.5s
}
}
}
else
{
if(0) //查表未使用
{
//转速表
DATA_ENGINE_SPEED_DISPLAYING = Common_Get_Disp_E_Speed();
if (DATA_ENGINE_SPEED_DISPLAYING > GaugesCtrl.ESpeedBackup) //转速增加,查上升表
{
while (GaugesCtrl.ESpeedSeg < GAUGES_TOTAL_TACHOMETER_SEG)
{
if (DATA_ENGINE_SPEED_DISPLAYING < GaugesTachoMeterSegIncTable[GaugesCtrl.ESpeedSeg])
break;
GaugesCtrl.ESpeedSeg++;
}
}
else if (DATA_ENGINE_SPEED_DISPLAYING < GaugesCtrl.ESpeedBackup) //转速减小,查下降表
{
while (GaugesCtrl.ESpeedSeg)
{
if (DATA_ENGINE_SPEED_DISPLAYING >= GaugesTachoMeterSegDecTable[GaugesCtrl.ESpeedSeg - 1])
break;
GaugesCtrl.ESpeedSeg--;
}
}
GaugesCtrl.ESpeedBackup = DATA_ENGINE_SPEED_DISPLAYING;
Common_Set_Gauges_E_Speed(GaugesCtrl.ESpeedSeg);
}
}
Common_Set_E_Speed_Test(MotorSelfTestTime.VehicleTestValue);
Common_Set_V_Speed_Test(MotorSelfTestTime.EngineTestValue);
Common_Set_Fuel_Test(MotorSelfTestTime.FuelTestValue / 100);
Common_Set_Temp_Test(MotorSelfTestTime.TempTestValue / 100);
}
*/
#ifndef _GAUGES_H_
#define _GAUGES_H_
#include "Common_Interface.h"
/******************************************************************************
ת�ٶ�������
******************************************************************************/
static const uint16_t GaugesTachoMeterSegIncTable[] =
{
/*=================
��ʾ�� | ת ��
---------+-------*/
/* 0 */ 200,
/* 1 */ 550,
/* 2 */ 1050,
/* 3 */ 1550,
/* 4 */ 2050,
/* 5 */ 2550,
/* 6 */ 3050,
/* 7 */ 3550,
/* 8 */ 4050,
/* 9 */ 4550,
/* 10 */ 5050,
/* 11 */ 5550,
/* 12 */ 6050,
/* 13 */ 6550,
/* 14 */ 7050,
/* 15 */ 7550,
/* 16 */ 8050,
/* 17 */ 65535,
/*=== ============*/
};
/******************************************************************************
ת�ٶ��½���
******************************************************************************/
static const uint16_t GaugesTachoMeterSegDecTable[] =
{
/*=================
��ʾ�� | ת ��
---------+-------*/
/* 0 */ 50,
/* 1 */ 450,
/* 2 */ 950,
/* 3 */ 1450,
/* 4 */ 1950,
/* 5 */ 2450,
/* 6 */ 2950,
/* 7 */ 3450,
/* 8 */ 3950,
/* 9 */ 4450,
/* 10 */ 4950,
/* 11 */ 5450,
/* 12 */ 5950,
/* 13 */ 6450,
/* 14 */ 6950,
/* 15 */ 7450,
/* 16 */ 7950,
/* 17 */ 65535,
/*===============*/
};
#define GAUGES_TOTAL_TACHOMETER_SEG (sizeof(GaugesTachoMeterSegIncTable) / 2)
typedef struct
{
uint16_t ESpeedBackup;
uint8_t ESpeedSeg;
}GaugesCtrlStruct;
//void Gauges_Management_Service(void);
#endif
This diff is collapsed.
/******************************************************************************
文 件 名:Key.h
功能描述:按键检测函数库头文件
作 者:张暄
版 本:V1.0
日 期:2016.11.21
******************************************************************************/
#ifndef _KEY_H_
#define _KEY_H_
#include "Line_In.h"
/******************************************************************************
按键列表
******************************************************************************/
/*** 按键属性结构 ***/
typedef struct
{
uint8_t(*InputSignal)(void);//输入信号
uint8_t HoldDetMode; //长按检测模式
uint8_t DoubleDetEn; //连按(双击)检测使能
}KeyAttrStruct;
/*** 长按检测模式 ***/
#define KEY_HOLD_DISABLE 0x00 //不支持长按检测
#define KEY_HOLD_ONLY 0x01 //仅支持按住检测
#define KEY_STUCK_ONLY 0x02 //仅支持卡住检测
#define KEY_HOLD_STUCK 0x03 //支持按住/卡住检测
#define KEY_HOLD_LONG 0x04 //支持按住/长按检测
#define KEY_HOLD_LONG_STUCK 0x05 //支持按住/长按/卡住检测
/******************************************************************************
旋扭按键状态检测结构
******************************************************************************/
typedef union{
uint8_t Byte;
struct
{
uint8_t KEY_LINE_L :1;
uint8_t KEY_LINE_R :1;
uint8_t KEY_NEWKEY :2;
uint8_t KEY_MIDKEY :2;
uint8_t KEY_OLDKEY :2;
}KnobSwitch;
}KEY_Union;
/******************************************************************************
旋扭按键状态输出结构
******************************************************************************/
typedef union
{
uint8_t Byte;
struct
{
uint8_t KEY_Right_Turn :2;
uint8_t KEY_Left_Turn :2;
}Sig;
}KeyStates;
extern volatile KeyStates KEYSTA;
extern uint8_t Get_Key1_Line_In_Sts(void);
extern uint8_t Get_Key2_Line_In_Sts(void);
/*** 按键属性列表 ***/
static const KeyAttrStruct KeyAttrTable[] =
{
/*=====================================================================
注意:1.应定义按键ID为该按键的属性位于本属性列表中的序号
2.如果只启用一种长按状态检测,应使能HoldDetEn而不是LongDetEn
-----------------------------------------------------------------------
ID | 输入信号 | 长按检测模式 | 连按检测使能 |
---------------------------------------------------------------------*/
{/* 01 */ Get_Key1_Line_In_Sts, KEY_HOLD_ONLY, 0 },
{/* 02 */ Get_Key2_Line_In_Sts, KEY_HOLD_ONLY, 0 },
/*===================================================================*/
};
/*** 按键ID列表 ***/
#define KEY_MODE 0x00
#define KEY_SET 0x01
/******************************************************************************
按键检测配置
******************************************************************************/
#define KEY_DOUBLE_INTERVAL 500 //连按(双击)最长间隔
//#define KEY_HOLD_THRESHOLD 800 //按住判定时间阈值
static const uint16_t KeyHoldThreshold[] = { 3000, 3000 }; //按住判定时间阈值,顺序与KeyAttrTable一一对应
#define KEY_LONG_THRESHOLD 10000 //长按判定时间阈值
#define KEY_STUCK_THRESHOLD 15000 //按键卡住判定时间阈值
#define KEY_TOTAL_NUMBER (sizeof(KeyAttrTable) / sizeof(KeyAttrStruct))
/******************************************************************************
按键状态枚举
******************************************************************************/
typedef enum
{
KEY_IDLE = 0, //空闲,按键未按下
KEY_PRESS, //按键短按 1
KEY_HOLD, //按键按住(比KEY_LONG时间短) 2
KEY_LONG, //按键长按 3
KEY_STUCK, //按键卡住 4
KEY_DOUBLE, //按键连续按下两次(双击) 5
}KeyStatusEnum;
/******************************************************************************
按键状态检测结构
******************************************************************************/
typedef struct
{
uint8_t UpdateEnable;
uint16_t Timer;
uint16_t IdleTimer; //间隔时间
KeyStatusEnum FinalStatus;
KeyStatusEnum CurrentStatus;
}KeyDetectStruct;
/******************************************************************************
函数声明
******************************************************************************/
void Key_Status_Init(void);
void Key_Status_Detect_Service(void);
void Reset_Key_Status(uint8_t Key);
void Key_Knob(void);
KeyStatusEnum Key_Get_Status(uint8_t Key);
KeyStatusEnum Key_Get_Current_Status(uint8_t Key);
#endif
#include "common.h"
#include "gpio.h"
#include "Line_in.h"
/*硬线输入服务函数调用周期 单位:ms*/
#define LINE_IN_CYCLE 10U
/*---------------------------------------------------------------------------------------*/
const Line_In_Attribute_st_t g_stLineInAttribute[] =
{
{ LINE_IN_IG_ON, 20U, 0U, LINE_IN_Get_RightTurn,},
{ LINE_IN_IG_ON, 20U, 0U, LINE_IN_Get_LeftTurn,},
{ LINE_IN_IG_ON, 60U, 0U, LINE_IN_Get_HighBeam,},
{ LINE_IN_IG_ON, 300U, 0U, LINE_IN_Get_ABS,},
{ LINE_IN_IG_ON, 300U, 0U, LINE_IN_Get_AutoStarStop,},
{ LINE_IN_IG_ON, 100U, 0U, LINE_IN_Get_TirePressure,},
{ LINE_IN_IG_ON, 2000U, 0U, LINE_IN_Get_OilPressure,},
{ LINE_IN_IG_ON, 300U, 0U, LINE_IN_Get_OBD,},
};
uint8_t LINE_IN_Get_RightTurn(void){
uint8_t Res = 0;
if(PORT_GetBit(RightTurn_P_In)){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_LeftTurn(void){
uint8_t Res = 0;
if(PORT_GetBit(LeftTurn_P_In)){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_HighBeam(void){
uint8_t Res = 0;
if(PORT_GetBit(HighBeam_P_In) == 0){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_ABS(void){
uint8_t Res = 0;
if(PORT_GetBit(ABS_N_In) == 1){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_AutoStarStop(void){
uint8_t Res = 0;
if(PORT_GetBit(AutoStarStop_N_In) == 0){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_TirePressure(void){
uint8_t Res = 0;
if(PORT_GetBit(TirePressure_N_In) == 0){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_OilPressure(void){
uint8_t Res = 0;
if(PORT_GetBit(OilPressure_N_In) == 0){
Res = 1;
}
return Res;
}
uint8_t LINE_IN_Get_OBD(void){
uint8_t Res = 0;
if(PORT_GetBit(OBD_N_In) == 0){
Res = 1;
}
return Res;
}
//=========================================================================================
/*以下内容不要改*/
//=========================================================================================
typedef struct
{
LineIn_LogicLevel_en_t u8Status; /*硬线最后输出状态*/
uint16_t u16TimeCount; /*消抖计时变量*/
uint8_t u8PinInputLast; /*实际硬线输入引脚记忆的上一次状态*/
} Line_In_Control_st_t;
Line_In_Control_st_t g_stLineInControl[LINE_IN_NUMBER];
/*电源状态*/
LINE_IN_WorkSt_en_t g_enLineInPowerStatus;
static void Line_In_Debounce_Handle(uint8_t Channel);
static void Line_In_Debounce_Handle(uint8_t Channel)
{
uint8_t enRealtimeLevel;
uint8_t (*pRead)(void);
pRead = g_stLineInAttribute[Channel].pfnLineIn_Read_Cbk;
if (pRead != NULL)
{
enRealtimeLevel = pRead();
if (g_stLineInControl[Channel].u8PinInputLast != enRealtimeLevel)
{
g_stLineInControl[Channel].u16TimeCount = 0U;
g_stLineInControl[Channel].u8PinInputLast = enRealtimeLevel;
}
else
{
/*硬线输入等于有效电平*/
if (1 == enRealtimeLevel)
{
g_stLineInControl[Channel].u16TimeCount += LINE_IN_CYCLE;
if (g_stLineInControl[Channel].u16TimeCount >= g_stLineInAttribute[Channel].u16ValidTime)
{
g_stLineInControl[Channel].u16TimeCount = 0U;
g_stLineInControl[Channel].u8Status = LINE_IN_LOGIC_VALID;
}
}
else
{
g_stLineInControl[Channel].u16TimeCount += LINE_IN_CYCLE;
if (g_stLineInControl[Channel].u16TimeCount >= g_stLineInAttribute[Channel].u16InvalidTime)
{
g_stLineInControl[Channel].u16TimeCount = 0U;
g_stLineInControl[Channel].u8Status = LINE_IN_LOGIC_INVALID;
}
}
}
}
}
void Line_In_SetPowerSt(LINE_IN_WorkSt_en_t u8PowerSt)
{
g_enLineInPowerStatus = u8PowerSt;
}
/*推荐值10ms*/
void Line_In_Debounce_Service(void)
{
uint8_t i;
for (i = 0u; i < LINE_IN_NUMBER; i++)
{
if (g_stLineInAttribute[i].enPowerStatus == LINE_IN_IG_ONOFF)
{
Line_In_Debounce_Handle(i);
}
else if (g_stLineInAttribute[i].enPowerStatus == LINE_IN_IG_ON)
{
if (g_enLineInPowerStatus == LINE_IN_IG_ON)
{
Line_In_Debounce_Handle(i);
}
else /*切换电源状态时已经操作过了*/
{
}
}
else /* if(LINE_IN_IG_OFF==g_stLineInAttribute[i].enPowerStatus) */
{
if (g_enLineInPowerStatus == LINE_IN_IG_OFF)
{
Line_In_Debounce_Handle(i);
}
else /*切换电源状态时已经操作过了*/
{
}
}
}
}
LineIn_LogicLevel_en_t Line_In_Get_Status(uint8_t Channel)
{
return g_stLineInControl[Channel].u8Status;
}
void Line_In_KL30_Init(void)
{
uint8_t i = 0U;
g_enLineInPowerStatus = LINE_IN_IG_OFF;
for (i = 0U; i < LINE_IN_NUMBER; i++)
{
g_stLineInControl[i].u16TimeCount = 0U;
g_stLineInControl[i].u8PinInputLast = 0U;
g_stLineInControl[i].u8Status = LINE_IN_LOGIC_INVALID;
}
}
void Line_In_KL15_ON_Init(void)
{
uint8_t i = 0U;
g_enLineInPowerStatus = LINE_IN_IG_ON;
for (i = 0U; i < LINE_IN_NUMBER; i++)
{
/*硬线在当前电源状态下不工作*/
if (g_stLineInAttribute[i].enPowerStatus == LINE_IN_IG_OFF)
{
g_stLineInControl[i].u8Status = LINE_IN_LOGIC_INVALID;
g_stLineInControl[i].u16TimeCount = 0U;
}
}
}
void Line_In_KL15_OFF_Init(void)
{
uint8_t i = 0U;
g_enLineInPowerStatus = LINE_IN_IG_OFF;
for (i = 0U; i < LINE_IN_NUMBER; i++)
{
/*硬线在当前电源状态下不工作*/
if (g_stLineInAttribute[i].enPowerStatus == LINE_IN_IG_ON)
{
g_stLineInControl[i].u8Status = LINE_IN_LOGIC_INVALID;
g_stLineInControl[i].u16TimeCount = 0U;
}
}
}
#ifndef LINE_IN_H__
#define LINE_IN_H__
#include "common.h"
#include "string.h"
/*
Note ! NOW LineIn only support 254 channel!!!!!
Note ! NOW LineIn only support 254 channel!!!!!
Note ! NOW LineIn only support 254 channel!!!!!
Note ! NOW LineIn only support 254 channel!!!!!
Note ! NOW LineIn only support 254 channel!!!!!
*/
/*?有硬线输入的索引*/
typedef enum
{
LINE_IN_RightTurn = 0u,
LINE_IN_LeftTurn,
LINE_IN_HighBeam,
LINE_IN_ABS,
LINE_IN_AutoStarStop,
LINE_IN_TirePressure,
LINE_IN_OilPressure,
LINE_IN_OBD,
LINE_IN_NUMBER,
} Line_In_Channel_en_t;
/*获取实时硬线电平函数指针*/
typedef struct
{
LINE_IN_WorkSt_en_t enPowerStatus; /*硬线工作的电源状?*/
uint16_t u16ValidTime; /*从无效到有效的消抖时? ms*/
uint16_t u16InvalidTime; /*从有效到无效的消抖时?*/
uint8_t (*pfnLineIn_Read_Cbk)(void); /*获取实时电平的回调函?*/
} Line_In_Attribute_st_t;
extern void Line_In_SetPowerSt(LINE_IN_WorkSt_en_t u8PowerSt);
/*10ms调用*/
extern void Line_In_Debounce_Service(void);
extern LineIn_LogicLevel_en_t Line_In_Get_Status(uint8_t Channel);
extern void Line_In_KL30_Init(void);
extern void Line_In_KL15_ON_Init(void);
extern void Line_In_KL15_OFF_Init(void);
extern uint8_t LINE_IN_Get_RightTurn(void);
extern uint8_t LINE_IN_Get_LeftTurn(void);
extern uint8_t LINE_IN_Get_HighBeam(void);
extern uint8_t LINE_IN_Get_ABS(void);
extern uint8_t LINE_IN_Get_AutoStarStop(void);
extern uint8_t LINE_IN_Get_TirePressure(void);
extern uint8_t LINE_IN_Get_OilPressure(void);
extern uint8_t LINE_IN_Get_OBD(void);
#endif
/******************************************************************************
文 件 名:LightDetect.c
功能描述:光线强度检测驱动文件
作 者:刘庆宇
版 本:V1.0
日 期:2021.1.15
******************************************************************************/
#include "common.h"
#include "LightDetect.h"
#include "LtDet_ORAP_29044.h"
static uint16_t LightValue = 0;
/******************************************************************************
Function:Light_Detect_KL30_Init
Description:该服务函数首次KL30时调用一次
Input:
Output:
******************************************************************************/
void Light_Detect_KL30_Init(void)
{
}
/******************************************************************************
Function:Light_Detect_KL15_Init
Description:该服务函数首次KL15时调用一次
Input:
Output:
******************************************************************************/
void Light_Detect_KL15_Init(void)
{
ORAP_29044_Init();
LightValue = 1200;
}
/******************************************************************************
Function:Light_Detect_Serivce
Description:光线检测服务函数,放在100ms任务
Input:
Output:
******************************************************************************/
void Light_Detect_Serivce(void)
{
static uint8_t temp8 = 20;
if(temp8 == 0){
LightValue = Read_Light_value();
}
else{
temp8--;
}
}
uint16_t Get_Light_Value(void)
{
return LightValue;
}
#ifndef LIGHT_DETECT_H
#define LIGHT_DETECT_H
extern void Light_Detect_KL30_Init(void);
extern void Light_Detect_KL15_Init(void);
extern void Light_Detect_Serivce(void);
uint16_t Get_Light_Value(void);
#endif
#include "LtDet_ORAP_29044.h"
#include "LtDet_Simulated_IIC_Master.h"
#define ORAP_29044_DEVICE_ADDR 0x88u
void LtDet_i2c_write_one_byte(uint8_t DEVICE_ADDR,uint8_t REG_ADDR,uint8_t data)
{
LtDet_IIC_Delay();
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR);
LtDet_IIC_Transmit_Data(REG_ADDR);
LtDet_IIC_Transmit_Data(data);
LtDet_IIC_Stop();
}
uint8_t LtDet_i2c_read_one_byte(uint8_t DEVICE_ADDR,uint8_t REG_ADDR)
{
uint8_t data = 0u;
LtDet_IIC_Delay();
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR);
LtDet_IIC_Transmit_Data(REG_ADDR);
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR +1);
data = LtDet_IIC_Receive_Data();
LtDet_IIC_Transmit_ACK(IIC_ACK);
LtDet_IIC_Stop();
return data;
}
void ORAP_29044_Init(void)
{
LtDet_IIC_Init();
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x00);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0F,0x29);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0E,0x00);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0F,0x00);
LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
}
uint16_t Read_Light_value(void)
{
uint16_t temp16;
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
temp16 = LtDet_i2c_read_one_byte(ORAP_29044_DEVICE_ADDR,0x0A);
LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
temp16 <<= 8;
temp16 |= LtDet_i2c_read_one_byte(ORAP_29044_DEVICE_ADDR,0x09);
return temp16;
}
#ifndef _LTDET_ORAP29044_H_
#define _LTDET_ORAP29044_H_
#include "common.h"
extern void ORAP_29044_Init(void);
extern uint16_t Read_Light_value(void);
#endif
#ifndef _MCU_CORE_PROTOCOL_H_
#define _MCU_CORE_PROTOCOL_H_
#include "common.h"
/*多媒体主机?讯端口*/
#define COM_CH (0x04u)
/*串口通信基础协议 1.0*/
#define PL_CORE_VERSION (0x00u)
#define PL_CORE_MARK (0x00u)
/*LENGHT标识?*/
#define LENGTH_ID_MASK (0x0FFFu)
#define LENGTH_CHKSUM_MASK (0xF000u)
#define LENGTH_CHKSUM_SHIFT (12u)
#define Uart_RX_MSG_FIFO_MAX_DEPTH (255u)
#define SEND_Key_Count 200u
#define EVENT_MSG_MAX_LENGTH (54u)
#define EVENT_MSG_MAX_QUEUE_NUM (6u)
#define PROTOCOL_ID_01 0x01u
#define PROTOCOL_ID_02 0x02u
#define PROTOCOL_ID_06 0x06u
#define IGON_SelfcheckingTimer 3200U //自检时间
typedef struct
{
uint8_t CID; /*命令标识?*/
uint8_t DLC; /*命令的长?*/
uint8_t Addr; /*存放在缓存的地址*/
} ArmMsgIndexStruct;
typedef struct
{
uint8_t Iptr; /*插入位置*/
uint8_t Optr; /*读取位置*/
uint8_t Depth; /*使用的深?*/
uint8_t Full; /*缓存存满*/
/*Buf*/
uint8_t Msg [ Uart_RX_MSG_FIFO_MAX_DEPTH ]; /*数据缓存?*/
ArmMsgIndexStruct MsgIndex [ Uart_RX_MSG_FIFO_MAX_DEPTH / 9u ]; /*定义?个数据结构用于提取和使用数据(/9按照?小单位数据长?)*/
} UartRxMsgFIFOStruct;
/*?有硬线输入的索引*/
typedef enum
{
CycMsg_01 = 0u,
CycMsg_02,
CycMsgNumber,
} CycMsg_t;
/*****************************************************************/
/*-------------ID:0x10 核心板初始化完毕 ----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 1u ];
struct
{
/*Byte4*/
uint8_t MessageID : 6;
uint8_t : 2;
} Sig;
} Receive_ID_10_Struct;
/*****************************************************************/
/*-------------ID:0x12-核心板向主板发?,周期100ms----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 7u ];
struct
{ /*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t blueToothConReq;
/*Byte6*/
uint8_t PhoneConnectSts;
/*Byte7*/
uint8_t PhoneType;
/*Byte8*/
uint8_t APP_Sts;
/*Byte9*/
uint8_t BlueToothConSts;
/*Byte10*/
uint8_t DisplaySts;
} Sig;
} Receive_ID_12_Struct;
/*****************************************************************/
/*-------------ID:0x01-00 不显? ----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 2u ];
struct
{
/*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t DispMode : 4;
uint8_t Language : 2;
uint8_t Theme : 1;
uint8_t ConnectPhone : 1;
} Sig;
} Send_ID_01_00_Struct;
/*****************************************************************/
/*-------------ID:0x01-01 ?机动? ----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 3u ];
struct
{
/*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t DispMode : 4;
uint8_t Language : 2;
uint8_t Theme : 1;
uint8_t ConnectPhone : 1;
/*Byte6*/
uint8_t Animation;
} Sig;
} Send_ID_01_01_Struct;
/*****************************************************************/
/*-------------ID:0x01-02 行车信息 ----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 22u ];
struct
{
/*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t DispMode : 4;
uint8_t SelfTest : 1;
uint8_t Language : 1;
uint8_t Theme : 1;
uint8_t ConnectPhone : 1;
/*Byte6*/
uint8_t LED_Coolant : 2;
uint8_t LED_ENGINE_OIL_LOW : 1;
uint8_t LED_ABS : 1;
uint8_t LED_HI_BEAM : 1;
uint8_t LED_MIL : 1;
uint8_t LED_RIGHT : 1;
uint8_t LED_LEFT : 1;
/*Byte7*/
uint8_t LED_Fuel : 2;
uint8_t LED_TPMS : 1;
uint8_t LED_Bluetooth : 1;
uint8_t LED_WIFI : 1;
uint8_t : 3;
/*Byte8*/
uint8_t Vspeed_H : 1;
uint8_t Espeed : 7;
/*Byte9*/
uint8_t Vspeed_L;
/*Byte10*/
uint8_t Vspeed_Bars;
/*Byte11*/
uint8_t Espeed_Bars;
/*Byte12*/
uint8_t Time_hour : 7;
uint8_t Time_colon : 1;
/*Byte13*/
uint8_t Time_minute;
/*Byte14*/
uint8_t Coolant_Temp_Bars;
/*Byte15*/
uint8_t Fuel_Bars;
/*Byte16*/
uint8_t Gear;
/*Byte17*/
uint8_t TOTAL_H4 : 4;
uint8_t Mileage_Unit : 2;
uint8_t Disp_Mileage_Mode : 2;
/*Byte18*/
uint8_t TOTAL_M8;
/*Byte19*/
uint8_t TOTAL_L8;
/*Byte20*/
uint8_t TRIPA_H8;
/*Byte21*/
uint8_t TRIPA_L8;
/*Byte22*/
uint8_t TRIPB_H8;
/*Byte23*/
uint8_t TRIPB_L8;
/*Byte24*/
uint8_t : 2;
uint8_t ICON_Apple : 2;
uint8_t ICON_Android : 2;
uint8_t ICON_Big_Wifi : 2;
/*Byte25*/
uint8_t Android_Or_Apple : 4;
uint8_t Connect_Phone_Sts : 4;
/*Byte26*/
uint8_t EasyNavigation;
} Sig;
} Send_ID_01_02_Struct;
/*****************************************************************/
/*-------------ID:0x01-03 菜单 ----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 6u ];
struct
{
/*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t DispMode : 4;
uint8_t Language : 2;
uint8_t Theme : 1;
uint8_t ConnectPhone : 1;
/*Byte6*/
uint8_t Data6;
/*Byte7*/
uint8_t Data7;
/*Byte8*/
uint8_t Data8;
/*Byte9*/
uint8_t Data9;
} Sig;
} Send_ID_01_03_Struct;
/*****************************************************************/
/*-------------ID:0x02-胎压和报警数?----------*/
/*****************************************************************/
typedef union
{
uint8_t Msg [ 11u ];
struct
{ /*Byte4*/
uint8_t MessageID : 6;
uint8_t PowerMode : 2;
/*Byte5*/
uint8_t DispMode;
/*Byte6*/
uint8_t TPMS_Unit;
/*Byte7*/
uint8_t TireH_Pressure_H8;
/*Byte8*/
uint8_t TireH_Pressure_L8;
/*Byte9*/
uint8_t TireR_Pressure_H8;
/*Byte10*/
uint8_t TireR_Pressure_L8;
/*Byte11*/
uint8_t TireH_Temp;
/*Byte12*/
uint8_t TireR_Temp;
/*Byte13*/
uint8_t Alarm_ID_H8;
/*Byte14*/
uint8_t Alarm_ID_L8;
} Sig;
} Send_ID_02_Struct;
typedef enum
{
DispNone = 0, //0:无显示
DisplayingAnimation, //1:显示开机动?
DisplayAnimationDone, //2:开机动画完?
DoingSelfTest, //3:自?扫表
SelfTestDone, //4:自?完成
DispDriveInfo, //5:行车显示信?
DispMenu, //6:菜单界?
}SocDispSts_E;
enum
{
Startup = 0u,
Run,
Timeout,
};
enum
{
SendEventMsgOk = 0u,
SendEventMsgError,
};
typedef struct
{
uint8_t SOC_St; /*系统启动状?? 0启动? 1启动成功 2启动超时*/
uint8_t AnimStatus;
uint32_t Time_out;
uint8_t Restart;
} Core_MonitorStructure;
extern uint8_t Uart2_tx_buf [ ];
extern uint8_t Uart2_rx_buf [ ];
extern Core_MonitorStructure Core_Monitor;
#define CORE_Timeout_CNT 2500u
extern void Protocol_KL15_ON_Init(void);
extern void MCU_Send_Service(uint8_t deltaTime);
extern void Enable_Cyc_Msg(CycMsg_t msgIndex);
extern void Disable_Cyc_Msg(CycMsg_t msgIndex);
extern uint8_t Send_Event_Msg(uint8_t type, uint8_t* data);
extern uint8_t Get_Event_Msg_Queue_Length(void);
extern void SetUartRxMsg_0x12(uint8_t * data);
extern SocDispSts_E GetSocDispSts(void);
void Drive_Info_Display_Update_Service(void);
void Selfcheck_Display_Update_Service(void);
#endif
This diff is collapsed.
#include "stdint.h"
#include "Key.h"
#ifndef MEU_PROCESS_H_
#define MEU_PROCESS_H_
#define _MN_IDX_NULL 0xff
#define _MN_IDX_NULL0 0x00
#define _MN_OPR_NULL (void *)0
#define NoKeyPressReturnThreshold 10000 //无按键操作返回阈�?
#define ANIMATION_TIME 3200 //�?机动画超时时间,单位ms
#define SELF_TEST_TIME 3200 //自检扫表超时时间,单位ms
#define EventMsgType_CurFault 0x21
#define EventMsgType_HisFault 0x22
#define EventMsgType_VersionNum 0x23
#define EventMsgType_MCUVersion 0x24
#define PART_NUM "70000TAJ0003" // part number QJ125T-6J
//#define PART_NUM "70000M310001" // part number 零件�?
#define MCU_version "1.0.003" //Must be 1.a.bbb format�??!!! 韫囧懘銆忛弰?1.a.bcd閺嶇厧绱¢敍? a<=9, bcd<=255
#define MCU_CompileData "231127" //The data format must be 6 Byte length!!! 閺冨爼妫块弽鐓庣�?韫囧懘銆忔稉?6娑擃亜鐡ч懞鍌炴毐�??
//#define MCU_version "1.0.000" //Must be 1.a.bbb format�??!!! 韫囧懘銆忛弰?1.a.bcd閺嶇厧绱¢敍? a<=9, bcd<=255
//#define MCU_CompileData "231124" //The data format must be 6 Byte length!!! 閺冨爼妫块弽鐓庣�?韫囧懘銆忔稉?6娑擃亜鐡ч懞鍌炴毐�??
//#define MCU_version "0.0.002" //Must be 1.a.bbb format�??!!! 韫囧懘銆忛弰?1.a.bcd閺嶇厧绱¢敍? a<=9, bcd<=255
//#define MCU_CompileData "231013" //The data format must be 6 Byte length!!! 閺冨爼妫块弽鐓庣�?韫囧懘銆忔稉?6娑擃亜鐡ч懞鍌炴毐�??
//1) 閺€璺哄�? xx 50 02 xx xx xx xx xx閸氬函绱濋崣顏勪粻鐠囧﹥鏌囨径鏍у絺閿涘奔绗夐崑婊冪安閻劌顦婚崣?
//2) 閸樼粯甯€妤傛ê甯囬幁顖氱潌閸旂喕鍏橀敍灞肩秵閻㈤潧甯囧銈嗗皾閺冨爼妫挎晶鐐插�??5�??
//#define MCU_version "1.0.006" //Must be 1.a.bbb format�?!!! 必须�?1.a.bcd格式�? a<=9, bcd<=255
//#define MCU_CompileData "230817" //The data format must be 6 Byte length!!! 时间格式必须�?6个字节长�?
//1) 增加F187读零件号
//2) �?15电马上关闭背光(之前延时10ms�?
//3) 增加清大计后扫表
//4) 修改R档变其它档位先显示白�?"R"问题
//5) 增加0x55C TRIPA/TRIPB同时清零
//#define PART_NUM "70000XB00000" // 零件�?
//#define MCU_version "V01.00.05" //20230731
//1) 修改燃油参数
//2) 燃油外发�?�?320�?
//#define MCU_version "V01.00.04" //20230612
//1)修改剩余清除�?�计次数外发错误问题
typedef enum _tagMenuName
{
_MN_DSP_ANIMATION = 0, //�?机动�?
_MN_DSP_DRIVE_INFO, //行车信息
_MN_DSP_PHONE_CONNECT, //手机互联
_MN_DSP_LEVEL1MENU_1, //界面切换
_MN_DSP_LEVEL1MENU_2, //时钟设置
_MN_DSP_LEVEL1MENU_3, //背光设置
_MN_DSP_LEVEL1MENU_4, //单位设置
_MN_DSP_LEVEL1MENU_5, //语言设置
_MN_DSP_LEVEL1MENU_6, //车辆设置
_MN_DSP_LEVEL1MENU_7, //手机蓝牙
_MN_DSP_LEVEL1MENU_8, //胎压设置
_MN_DSP_LEVEL1MENU_9, //�?�?
_MN_DSP_LEVEL2MENU_1, //界面切换-黑夜/白天/自动
_MN_DSP_LEVEL2MENU_2, //时钟设置
_MN_DSP_LEVEL2MENU_3, //背光设置
_MN_DSP_LEVEL2MENU_6, //车辆设置
_MN_DSP_LEVEL2MENU_7_1, //手机蓝牙-蓝牙连接
_MN_DSP_LEVEL2MENU_7_2, //手机蓝牙-同步联系�?
_MN_DSP_LEVEL2MENU_7_3, //手机蓝牙-蓝牙名称
_MN_DSP_LEVEL2MENU_7_4, //手机蓝牙-�?�?
_MN_DSP_LEVEL2MENU_8_1, //车辆设置-压力单位设置
_MN_DSP_LEVEL2MENU_8_2, //车辆设置-前轮传感器学�?
_MN_DSP_LEVEL2MENU_8_3, //车辆设置-后轮传感器学�?
_MN_DSP_LEVEL2MENU_8_4, //车辆设置-�?�?
}MenuName_E;
typedef enum _dayOrNightControl
{
DayOrNight_Automatic,
Manual_Day,
Manual_Night,
}dayOrNightControl_E;
typedef enum _unitSetting
{
Metric,
Imperial,
}unitSetting_E;
typedef enum {
BL_Automatic,
BL_Manual,
}BG_MODE;
typedef enum {
BL_USER_SET_LV_1,
BL_USER_SET_LV_2,
BL_USER_SET_LV_3,
BL_USER_SET_LV_4,
BL_USER_SET_LV_5,
BL_USER_SET_LV_AUTO,
BL_REAL_LV_TOTAL,
}BL_USER_SET_LV_E;
typedef enum {
Mileage_Mode_Total = 0,
Mileage_Mode_TripA,
Mileage_Mode_TripB,
Mileage_Mode_FaultCode,
Mileage_Mode_TempErr,
}Disp_Mileage_Mode_E;
typedef uint8_t _MENU_IDX;
typedef struct
{
_MENU_IDX VK_IDX_MODE;
_MENU_IDX VK_IDX_SET;
void (*Enter)(void);
void (*Do)(void);
void (*Exit)(void);
} _MenuOptTab;
extern void MenuKL30Init(void);
extern void MenuIgnOnInit(void);
extern void MenuManage(void);
extern uint8_t Get_Menu_Byte6(void);
extern uint8_t Get_Menu_Byte7(void);
extern uint8_t Get_Menu_Byte8(void);
extern uint8_t Get_Menu_Byte9(void);
extern BL_USER_SET_LV_E Get_BL_User_Set_Level(void);
extern Disp_Mileage_Mode_E Get_Disp_Mileage_Mode(void);
extern uint8_t Get_Self_Test_Sts(void);
extern uint8_t Get_Unit_Setting(void);
extern PHONE_CONNECT_t Common_Get_ConnectPhoneSts(void);
extern void MenuStatusSwitchODO(KeyStatusEnum set_button);
extern void MenuStatusSwitchUnit(KeyStatusEnum set_button);
extern dayOrNightControl_E Get_Day_Or_Night_Control(void);
extern uint8_t get_SEG_Check_Contrl(void);
extern uint8_t Get_TCS_Status(void);
#endif
#include "PowerManagement.h" #include "PowerManagement.h"
#include "PowerManagement_user.h" #include "PowerManagement_user.h"
#include "System_Monitor.h" #include "System_Monitor.h"
#include "Line_in.h"
#include "gpio.h" #include "gpio.h"
#include "Common_Interface.h" #include "Common_Interface.h"
#include "clk.h" #include "clk.h"
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
#include "sci.h" #include "sci.h"
#include "Telltales_Lib.h" #include "Telltales_Lib.h"
#include "Telltales_user.h" #include "Telltales_user.h"
#include "MCU_Core_Protocol.h"
#include "tim4.h" #include "tim4.h"
#include "CalcFrequency.h"
#include "Fuel.h" #include "Fuel.h"
#include "CoolantTemp.h"
#include "Services_Mileage_User.h" #include "Services_Mileage_User.h"
#include "eeManager_Interface.h" #include "eeManager_Interface.h"
#include "Data_Gear.h"
#include "timerA_B_C.h" #include "timerA_B_C.h"
#include "Key.h"
#include "Menus.h"
#include "uds_includes.h" #include "uds_includes.h"
#include "U2_uds_includes.h" #include "U2_uds_includes.h"
#include "CAN_User.h" #include "CAN_User.h"
...@@ -37,20 +37,19 @@ uint16_t g_sleepDelay = 0; ...@@ -37,20 +37,19 @@ uint16_t g_sleepDelay = 0;
void Power_KL30_Init ( void ) void Power_KL30_Init ( void )
{ {
Sys_KL30_Init(); Sys_KL30_Init();
Line_In_KL30_Init();
// UART2_Init(115200); // UART2_Init(115200);
// uart2_User_KL30_Init(); // uart2_User_KL30_Init();
Telltales_Init(); Telltales_Init();
Fuel_KL30_Init(); Fuel_KL30_Init();
CoolantTemp_KL30_Init();
// eeprom_StoreInfo_Init( );
Data_Gear_KL30_Init();
//APP_CAN_Init();
//SEG_LCD_Init();
BU98R10_Init(); BU98R10_Init();
MenuKL30Init();
Data_User_Mileage_KL30Init(); Data_User_Mileage_KL30Init();
} }
...@@ -195,13 +194,13 @@ void Power_Wakeup_Init ( void ) ...@@ -195,13 +194,13 @@ void Power_Wakeup_Init ( void )
Sys_Tick_Timer_Start(); Sys_Tick_Timer_Start();
Analog_Signal_Conv_Init(); Analog_Signal_Conv_Init();
Sys_WakeUp_Init(); Sys_WakeUp_Init();
Line_In_KL30_Init();
Telltales_Init(); Telltales_Init();
// UART2_Init(115200); // UART2_Init(115200);
// uart2_User_KL30_Init(); // uart2_User_KL30_Init();
Common_DataInit(); Common_DataInit();
Key_Status_Init();
CalcFreq_KL15_Init();
IS31_OFF_Wakeup(); IS31_OFF_Wakeup();
IS31FL3236_Update(); IS31FL3236_Update();
Init93015_IIC();//4034 Init93015_IIC();//4034
...@@ -217,7 +216,7 @@ void Power_Wakeup_Init ( void ) ...@@ -217,7 +216,7 @@ void Power_Wakeup_Init ( void )
void Power_IG_OFF_Init(void) void Power_IG_OFF_Init(void)
{ {
Line_In_KL15_OFF_Init();
Common_Set_IG_Sts(COMMON_POWER_OFF); Common_Set_IG_Sts(COMMON_POWER_OFF);
Set_CanSleepDelayTime(8000); Set_CanSleepDelayTime(8000);
g_sleepDelay = 300;//延时30s休眠 g_sleepDelay = 300;//延时30s休眠
...@@ -225,25 +224,20 @@ void Power_IG_OFF_Init(void) ...@@ -225,25 +224,20 @@ void Power_IG_OFF_Init(void)
} }
void Power_IG_ON_Init(void) void Power_IG_ON_Init(void)
{ {
Line_In_KL15_ON_Init();
Telltales_KL15_Init(); Telltales_KL15_Init();
bsp_CAN_SleepRelease(); bsp_CAN_SleepRelease();
bsp_CAN_Init(); bsp_CAN_Init();
Enable_Cyc_Msg(CycMsg_01);
Enable_Cyc_Msg(CycMsg_02);
Common_DataInit(); Common_DataInit();
Fuel_KL15_Init(); Fuel_KL15_Init();
CoolantTemp_KL15_Init();
Data_Gear_KL15_Init();
// PORT_SetBit(SOC_3V3_en); // PORT_SetBit(SOC_3V3_en);
TMB0_PWM_Pin33_Init(); TMB0_PWM_Pin33_Init();
DiagnosisInit_main(); DiagnosisInit_main();
U2_DiagnosisInit_main(); U2_DiagnosisInit_main();
Key_Status_Init();
MenuIgnOnInit();
Protocol_KL15_ON_Init();
uart2_User_KL15_Init(); uart2_User_KL15_Init();
CalcFreq_KL15_Init();
APP_CAN_Init(); APP_CAN_Init();
Common_Set_IG_Sts(COMMON_POWER_ON); Common_Set_IG_Sts(COMMON_POWER_ON);
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
#include "Telltales_user.h" #include "Telltales_user.h"
#include "Flash_synchronizer.h" #include "Flash_synchronizer.h"
#include "Common_Interface.h" #include "Common_Interface.h"
#include "Line_in.h"
#include "CAN_User.h" #include "CAN_User.h"
#include "CoolantTemp.h"
#include "gpio.h" #include "gpio.h"
#include "Fuel.h" #include "Fuel.h"
#include "CoolantTemp.h"
#include "CAN_Communication_Matrix.h" #include "CAN_Communication_Matrix.h"
#include "MCU_Core_Protocol.h"
#include "Data_Gear.h"
#include "app_Telltales.h" #include "app_Telltales.h"
#include "Menus.h"
#include "Fuel.h" #include "Fuel.h"
#include "Key.h"
#include "Menus.h"
const LED_Attribute_st LED_Attribute[LED_Max]__attribute__ ((aligned (4))); const LED_Attribute_st LED_Attribute[LED_Max]__attribute__ ((aligned (4)));
Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ] __attribute__ ((aligned (4))); Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ] __attribute__ ((aligned (4)));
...@@ -35,20 +35,20 @@ void Telltales_Init(void) ...@@ -35,20 +35,20 @@ void Telltales_Init(void)
const LED_Attribute_st LED_Attribute[LED_Max] = const LED_Attribute_st LED_Attribute[LED_Max] =
{ {
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */ /* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
{ m_LED_RIGHT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//右转向 { m_LED_RIGHT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//右转向
{ m_LED_LEFT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//左转向 { m_LED_LEFT , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//左转向
{ m_LED_HI_BEAM , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//远光灯 { m_LED_HI_BEAM , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//远光灯
{ m_LED_MIL , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//发动机报警灯 { m_LED_MIL , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//发动机报警灯
{ m_LED_ABS , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//ABS_低有效 { m_LED_ABS , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//ABS_低有效
{ m_LED_TSC , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//TSC { m_LED_TSC , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//TSC
{ m_LED_AutoStarStop , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//自动启停 { m_LED_AutoStarStop , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//自动启停
{ m_LED_Batterylow , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//蓄电池电压报警 { m_LED_Batterylow , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//蓄电池电压报警
{ m_LED_Auto_HI_BEAM , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//自动远光灯(预留) { m_LED_Auto_HI_BEAM , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//自动远光灯(预留)
{ m_LED_Shore , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//边撑状态 { m_LED_Shore , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//边撑状态
{ m_LED_ENGINE_OIL_LOW , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//机油压力报警灯(预留) { m_LED_ENGINE_OIL_LOW , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//机油压力报警灯(预留)
{ m_LED_TPMS , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//胎压功能(预留) { m_LED_TPMS , NoSelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//胎压功能(预留)
{ m_LED_READY , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//READY { m_LED_READY , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//READY
{ m_LED_Fuel , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//燃油 { m_LED_Fuel , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//燃油
{ m_LED_Temp , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, IGON_SelfcheckingTimer, NULL , NULL },//水温 { m_LED_Temp , SelfCheck , NoExterNalCheck , LED_IGN_ON , 0u, 3000ul, Common_Get_IG_Sts , Common_Get_IG_Sts },//水温
}; };
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "stdlib.h" #include "stdlib.h"
#include "common.h" #include "common.h"
#include "Sys_Tick.h" #include "Sys_Tick.h"
#include "BGLInterface.h"
#include "gpio.h" #include "gpio.h"
#include "Sys_Scheduler.h" #include "Sys_Scheduler.h"
#include "eepromManage.h" #include "eepromManage.h"
......
...@@ -15,7 +15,7 @@ Includes ...@@ -15,7 +15,7 @@ Includes
#include "userdefine.h" #include "userdefine.h"
#include "BAT32A239.h" #include "BAT32A239.h"
#include "sci.h" #include "sci.h"
#include "MCU_Core_Protocol.h"
#include "gpio.h" #include "gpio.h"
/*********************************************************************************************************************** /***********************************************************************************************************************
Pragma directive Pragma directive
...@@ -108,17 +108,7 @@ volatile uint8_t g_iic31_rx_end; /* iic31 receive data end */ ...@@ -108,17 +108,7 @@ volatile uint8_t g_iic31_rx_end; /* iic31 receive data end */
volatile uart_state_t g_uart2_tx_state; volatile uart_state_t g_uart2_tx_state;
void UART_Ch2_Send_Multiple_Byte( uint8_t* buf, uint8_t len ) void UART_Ch2_Send_Multiple_Byte( uint8_t* buf, uint8_t len )
{ {
uint32_t i;
for(i=0; i<len; i++){
Uart2_tx_buf[i] = *(buf+i);
}
gp_uart2_tx_address = Uart2_tx_buf;
g_uart2_tx_count = len;
SCI1->TXD2 = *gp_uart2_tx_address;
gp_uart2_tx_address++;
g_uart2_tx_count--;
g_uart2_tx_state = UART_TX_BUSY;
} }
uart_state_t Get_Uart2_State(void) uart_state_t Get_Uart2_State(void)
...@@ -1171,15 +1161,7 @@ static void uart2_interrupt_send(void) ...@@ -1171,15 +1161,7 @@ static void uart2_interrupt_send(void)
***********************************************************************************************************************/ ***********************************************************************************************************************/
static void uart2_callback_receiveend(void) static void uart2_callback_receiveend(void)
{ {
/* Start user code. Do not edit comment generated here */
//g_uart2_rx_count = 0xffff;
//if(Uart2_rx_buf[1] == 0x10){
// uart_0x10_Rev_Flag = 1;
//}
//else if(Uart2_rx_buf[1] == 0x12){
// SetUartRxMsg_0x12(Uart2_rx_buf);
//}
/* End user code. Do not edit comment generated here */
} }
/*********************************************************************************************************************** /***********************************************************************************************************************
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#include "tim4.h" #include "tim4.h"
#include "CalcFrequency.h"
#define INTERVAL_TIMER_MODE 0 #define INTERVAL_TIMER_MODE 0
#define CAPTURE_MODE 0x0104 #define CAPTURE_MODE 0x0104
...@@ -206,13 +206,13 @@ void bsp_tim4_01_isr_Handler( void ) ...@@ -206,13 +206,13 @@ void bsp_tim4_01_isr_Handler( void )
if(*pTMRmn == EdgeRising){ if(*pTMRmn == EdgeRising){
*pTMRmn = EdgeFalling; *pTMRmn = EdgeFalling;
InputRevHighPulseTime(pTDRmn,pTSRmn); //高低电平是反的,我也不知道为啥 //InputRevHighPulseTime(pTDRmn,pTSRmn); //高低电平是反的,我也不知道为啥
} }
else{ else{
*pTMRmn = EdgeRising; *pTMRmn = EdgeRising;
InputRevLowPulseTime(pTDRmn,pTSRmn); //InputRevLowPulseTime(pTDRmn,pTSRmn);
} }
INTC_ClearPendingIRQ(TM01_IRQn); INTC_ClearPendingIRQ(TM01_IRQn);
......
...@@ -86,10 +86,7 @@ void Sys_Startup_Pre_Init(void) ...@@ -86,10 +86,7 @@ void Sys_Startup_Pre_Init(void)
* \attention * \attention
* \retval None * \retval None
******************************************************************************/ ******************************************************************************/
//uint8_t u8ResetFlag = 0;
//extern uint32_t u32ResetFlag;
//extern uint32_t TestBackupRam;
void Sys_Startup_Init(void) void Sys_Startup_Init(void)
{ {
...@@ -127,7 +124,7 @@ void Sys_Startup_Init(void) ...@@ -127,7 +124,7 @@ void Sys_Startup_Init(void)
******************************************************************************/ ******************************************************************************/
void Sys_Sleep_Init(void) void Sys_Sleep_Init(void)
{ {
// Sys_Tick_Timer_Stop();
} }
/**************************************************************************//** /**************************************************************************//**
......
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
#include "timerA_B_C.h" #include "timerA_B_C.h"
extern uint32_t u32ResetFlag;
extern void Power_Sleep_Init(void); extern void Power_Sleep_Init(void);
extern void Sys_Enter_Sleep_Mode(void); extern void Sys_Enter_Sleep_Mode(void);
extern void Power_Wakeup_Init ( void ); extern void Power_Wakeup_Init ( void );
uint8_t socPowerEn = 0;
int main(void) int main(void)
{ {
......
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "CAN_User.h" #include "CAN_User.h"
#include "Analog_Signals.h" #include "Analog_Signals.h"
#include "flash.h" #include "flash.h"
#include "Menus.h"
#define GLOBALS_UDS_CFG #define GLOBALS_UDS_CFG
#define GLOBALS_USER_DEF #define GLOBALS_USER_DEF
...@@ -1220,11 +1220,11 @@ void App_22_service(_N_USData *AppUSData) ...@@ -1220,11 +1220,11 @@ void App_22_service(_N_USData *AppUSData)
{ {
// case DID0FA0: //读-当前会话模式 // case DID0FA0: //读-当前会话模式
case 0xF195: //读软件版本号 case 0xF195: //读软件版本号
pTemp8 = MCU_version;
MCU_SWversion[0] = pTemp8[0]; MCU_SWversion[0] = pTemp8[0];
MCU_SWversion[1] = pTemp8[2]; MCU_SWversion[1] = pTemp8[2];
MCU_SWversion[5] = (pTemp8[4]&0x0f)*100 + (pTemp8[5]&0x0f)*10 + (pTemp8[6]&0x0f); MCU_SWversion[5] = (pTemp8[4]&0x0f)*100 + (pTemp8[5]&0x0f)*10 + (pTemp8[6]&0x0f);
pTemp8 = MCU_CompileData;
MCU_SWversion[2] = (pTemp8[0]&0x0f)*10 + (pTemp8[1]&0x0f); MCU_SWversion[2] = (pTemp8[0]&0x0f)*10 + (pTemp8[1]&0x0f);
MCU_SWversion[3] = (pTemp8[2]&0x0f)*10 + (pTemp8[3]&0x0f); MCU_SWversion[3] = (pTemp8[2]&0x0f)*10 + (pTemp8[3]&0x0f);
MCU_SWversion[4] = (pTemp8[4]&0x0f)*10 + (pTemp8[5]&0x0f); MCU_SWversion[4] = (pTemp8[4]&0x0f)*10 + (pTemp8[5]&0x0f);
...@@ -1235,7 +1235,7 @@ void App_22_service(_N_USData *AppUSData) ...@@ -1235,7 +1235,7 @@ void App_22_service(_N_USData *AppUSData)
} }
break; break;
case 0xF194: //读软件编码 case 0xF194: //读软件编码
pTemp8 = PART_NUM;
MCU_SoftCode[2] = pTemp8[5]; MCU_SoftCode[2] = pTemp8[5];
MCU_SoftCode[3] = pTemp8[6]; MCU_SoftCode[3] = pTemp8[6];
MCU_SoftCode[4] = pTemp8[7]; MCU_SoftCode[4] = pTemp8[7];
...@@ -1260,7 +1260,7 @@ void App_22_service(_N_USData *AppUSData) ...@@ -1260,7 +1260,7 @@ void App_22_service(_N_USData *AppUSData)
} }
break; break;
case 0xF187: // 读零件号 case 0xF187: // 读零件号
pTemp8 = PART_NUM;
for(i=0;i<MaxBuff;i++){ for(i=0;i<MaxBuff;i++){
temp8 = *(pTemp8++); temp8 = *(pTemp8++);
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#include "U2_app_ServiceProc.h" #include "U2_app_ServiceProc.h"
#include <string.h> #include <string.h>
#include "CAN_User.h" #include "CAN_User.h"
#include "CoolantTemp.h"
#define U2_GLOBALS_UDS_CFG #define U2_GLOBALS_UDS_CFG
#define U2_GLOBALS_USER_DEF #define U2_GLOBALS_USER_DEF
volatile _U2_DiagnoCtl U2_DiagnoCtl; //诊断当前状?? volatile _U2_DiagnoCtl U2_DiagnoCtl; //诊断当前状??
volatile _U2_N_USData U2_Exct_USData; //报文接收的ID数据 volatile _U2_N_USData U2_Exct_USData; //报文接收的ID数据
volatile _U2_DiagClock U2_DiagClock; volatile _U2_DiagClock U2_DiagClock;
volatile _U2_ErrorFrame U2_Error; //错误信息 volatile _U2_ErrorFrame U2_Error; //错误信息
...@@ -233,7 +233,7 @@ void U2_Diagnosis_main(void) ...@@ -233,7 +233,7 @@ void U2_Diagnosis_main(void)
default: default:
/* Error.N_TAtype = ID_PhyAddr; /* Error.N_TAtype = ID_PhyAddr;
Error.FrameErr = ServiceNotSupported; //服务不支? Error.FrameErr = ServiceNotSupported; //服务不支?
Error.RespSerId = Exct_USData.ind.MsgData[0];*/ Error.RespSerId = Exct_USData.ind.MsgData[0];*/
break; break;
} }
...@@ -375,10 +375,10 @@ void U2_App_62_service(_U2_N_USData *AppUSData) ...@@ -375,10 +375,10 @@ void U2_App_62_service(_U2_N_USData *AppUSData)
switch (DID) switch (DID)
{ {
case U2_DID0005: //?-当前会话模式 case U2_DID0005: //?-当前会话模式
U2_App_CopyRam((uint8_t *)&U2_DiagReciveGaugePara.CoolantTemp, (uint8_t *)&AppUSData->ind.MsgData[3], (AppUSData->ind.Length - 3)); U2_App_CopyRam((uint8_t *)&U2_DiagReciveGaugePara.CoolantTemp, (uint8_t *)&AppUSData->ind.MsgData[3], (AppUSData->ind.Length - 3));
UDS_62_MsgRecFlg = 1; UDS_62_MsgRecFlg = 1;
Reset_CoolantTemp_Signal_Time();
SetSendUdsTimeCount_220005(0); SetSendUdsTimeCount_220005(0);
break; break;
......
This diff is collapsed.
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>.\source\System;.\source\Driver\inc;.\source\Application;.\source\Application\LINE_IN;.\source\Application\PowerManagement;.\source\Application\RTE;.\source\Application\MCU_Core_Protocol;.\source\Application\Telltales;.\source\Application\CalcFrequency;.\source\Application\Fuel;.\source\Application\Eeprom;.\source\Application\DataProcessor;.\source\Application\LightDetect;.\source\Application\BackLight;.\source\Application\Key;.\source\Application\Menu;.\source\Application\APPCan;.\source\UDS;.\source\Application\Gauges;.\source\Application\CoolantTemp;.\source\UDS2;.\\RTE\Device\BAT32A239KK64FB;.\source\Application\Mileage;.\source\Application\Display\GUI_LCD_DIS;.\source\Application\Display\SEG_LCD_DIS</IncludePath> <IncludePath>.\source\System;.\source\Driver\inc;.\source\Application;.\source\Application\LINE_IN;.\source\Application\PowerManagement;.\source\Application\RTE;.\source\Application\MCU_Core_Protocol;.\source\Application\Telltales;.\source\Application\Fuel;.\source\Application\Eeprom;.\source\Application\DataProcessor;.\source\Application\LightDetect;.\source\Application\BackLight;.\source\Application\Key;.\source\Application\Menu;.\source\Application\APPCan;.\source\UDS;.\source\Application\Gauges;.\source\Application\CoolantTemp;.\source\UDS2;.\\RTE\Device\BAT32A239KK64FB;.\source\Application\Mileage;.\source\Application\Display\GUI_LCD_DIS;.\source\Application\Display\SEG_LCD_DIS</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
...@@ -608,16 +608,6 @@ ...@@ -608,16 +608,6 @@
<Group> <Group>
<GroupName>Application</GroupName> <GroupName>Application</GroupName>
<Files> <Files>
<File>
<FileName>Line_In.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\LINE_IN\Line_In.h</FilePath>
</File>
<File>
<FileName>Line_In.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\LINE_IN\Line_In.c</FilePath>
</File>
<File> <File>
<FileName>PowerManagement.h</FileName> <FileName>PowerManagement.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
...@@ -668,16 +658,6 @@ ...@@ -668,16 +658,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\source\Application\RTE\Common_Interface.c</FilePath> <FilePath>.\source\Application\RTE\Common_Interface.c</FilePath>
</File> </File>
<File>
<FileName>MCU_Core_Protocol.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\MCU_Core_Protocol\MCU_Core_Protocol.h</FilePath>
</File>
<File>
<FileName>MCU_Core_Protocol.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\MCU_Core_Protocol\MCU_Core_Protocol.c</FilePath>
</File>
<File> <File>
<FileName>Telltales_user.h</FileName> <FileName>Telltales_user.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
...@@ -698,16 +678,6 @@ ...@@ -698,16 +678,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\source\Application\Telltales\Flash_synchronizer.c</FilePath> <FilePath>.\source\Application\Telltales\Flash_synchronizer.c</FilePath>
</File> </File>
<File>
<FileName>CalcFrequency.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\CalcFrequency\CalcFrequency.h</FilePath>
</File>
<File>
<FileName>CalcFrequency_user.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\CalcFrequency\CalcFrequency_user.c</FilePath>
</File>
<File> <File>
<FileName>Fuel.h</FileName> <FileName>Fuel.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
...@@ -743,56 +713,6 @@ ...@@ -743,56 +713,6 @@
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>.\source\Application\Eeprom\eeprom_includes.h</FilePath> <FilePath>.\source\Application\Eeprom\eeprom_includes.h</FilePath>
</File> </File>
<File>
<FileName>Data_Gear.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\DataProcessor\Data_Gear.h</FilePath>
</File>
<File>
<FileName>Data_Gear.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\DataProcessor\Data_Gear.c</FilePath>
</File>
<File>
<FileName>BackgroundLight.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\BackLight\BackgroundLight.h</FilePath>
</File>
<File>
<FileName>BackGroundLight.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\BackLight\BackGroundLight.c</FilePath>
</File>
<File>
<FileName>BGLInterface.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\BackLight\BGLInterface.h</FilePath>
</File>
<File>
<FileName>BGLInterface.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\BackLight\BGLInterface.c</FilePath>
</File>
<File>
<FileName>Key.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\Key\Key.h</FilePath>
</File>
<File>
<FileName>Key.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\Key\Key.c</FilePath>
</File>
<File>
<FileName>Menus.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\Menu\Menus.h</FilePath>
</File>
<File>
<FileName>Menus.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\Menu\Menus.c</FilePath>
</File>
<File> <File>
<FileName>CAN_Communication_Matrix.h</FileName> <FileName>CAN_Communication_Matrix.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
...@@ -824,39 +744,34 @@ ...@@ -824,39 +744,34 @@
<FilePath>.\source\Application\APPCan\CAN_User.c</FilePath> <FilePath>.\source\Application\APPCan\CAN_User.c</FilePath>
</File> </File>
<File> <File>
<FileName>Gauges.c</FileName> <FileName>app_Telltales.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\source\Application\Gauges\Gauges.c</FilePath> <FilePath>.\source\Application\Telltales\app_Telltales.c</FilePath>
</File> </File>
<File> <File>
<FileName>Gauges.h</FileName> <FileName>app_Telltales.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>.\source\Application\Gauges\Gauges.h</FilePath> <FilePath>.\source\Application\Telltales\app_Telltales.h</FilePath>
</File> </File>
<File> <File>
<FileName>CoolantTemp.c</FileName> <FileName>Gui_Lcd_Dis.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\source\Application\CoolantTemp\CoolantTemp.c</FilePath> <FilePath>.\source\Application\Display\GUI_LCD_DIS\Gui_Lcd_Dis.c</FilePath>
</File> </File>
<File> <File>
<FileName>CoolantTemp.h</FileName> <FileName>Gui_Lcd_Dis.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>.\source\Application\CoolantTemp\CoolantTemp.h</FilePath> <FilePath>.\source\Application\Display\GUI_LCD_DIS\Gui_Lcd_Dis.h</FilePath>
</File>
<File>
<FileName>CalcFrequency.lib</FileName>
<FileType>4</FileType>
<FilePath>.\source\Application\CalcFrequency\CalcFrequency.lib</FilePath>
</File> </File>
<File> <File>
<FileName>app_Telltales.c</FileName> <FileName>Gui_Seg_Dis.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>.\source\Application\Telltales\app_Telltales.c</FilePath> <FilePath>.\source\Application\Display\SEG_LCD_DIS\Gui_Seg_Dis.c</FilePath>
</File> </File>
<File> <File>
<FileName>app_Telltales.h</FileName> <FileName>Gui_Seg_Dis.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>.\source\Application\Telltales\app_Telltales.h</FilePath> <FilePath>.\source\Application\Display\SEG_LCD_DIS\Gui_Seg_Dis.h</FilePath>
</File> </File>
<File> <File>
<FileName>libMileage.lib</FileName> <FileName>libMileage.lib</FileName>
...@@ -878,26 +793,6 @@ ...@@ -878,26 +793,6 @@
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>.\source\Application\Mileage\Services_Mileage_User.h</FilePath> <FilePath>.\source\Application\Mileage\Services_Mileage_User.h</FilePath>
</File> </File>
<File>
<FileName>Gui_Lcd_Dis.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\Display\GUI_LCD_DIS\Gui_Lcd_Dis.c</FilePath>
</File>
<File>
<FileName>Gui_Lcd_Dis.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\Display\GUI_LCD_DIS\Gui_Lcd_Dis.h</FilePath>
</File>
<File>
<FileName>Gui_Seg_Dis.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\Display\SEG_LCD_DIS\Gui_Seg_Dis.c</FilePath>
</File>
<File>
<FileName>Gui_Seg_Dis.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\Display\SEG_LCD_DIS\Gui_Seg_Dis.h</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
......
#ifndef __SOUND_IIC_H__
#define __SOUND_IIC_H__
/** SWDG *********************************************************************/
#define MAX_NUM 30
typedef void (*aw9310x_irq_init_t)(void(*)(void));
typedef struct {
uint16_t Value_Filter[MAX_NUM];
uint16_t MaxValue;
uint16_t MinValue;
uint16_t CurValue;
uint16_t AveValue;
uint32_t CumulativeSum;
uint8_t MaxValuePtr;
uint8_t MinValuePtr;
}PD_VALUE_FILTER_PARA;
extern PD_VALUE_FILTER_PARA PD1_Value;
extern PD_VALUE_FILTER_PARA PD2_Value;
extern void Init93015_IIC(void);
uint8_t GET_Key_Prosess(void);
#endif /* __SOUND_IIC_H__ */
This diff is collapsed.
/**************************************************************************//**
* \file Analog_Signals.h
* \brief Analog signal processing
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2023/9/23 14:09:24
* Cfg Tool Ver : 1.1.0
* Engineer : LQY
* (c) Heilongjiang TYW electronics co., LTD
*
******************************************************************************/
#ifndef ANALOG_SIGNALS_H__
#define ANALOG_SIGNALS_H__
/* Includes -----------------------------------------------------------------*/
#include "ADC.h"
#include "Analog_Circuits.h"
/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern {
#endif
/*! @{ */
/* Exported types ------------------------------------------------------------*/
enum ADCChName
{
ADC_CH_KL30_VOLTAGE = 0,
ADC_CH_KL15_VOLTAGE,
ADC_CH_FUEL_VREF,
ADC_CH_FUEL1,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (4U)
#define ADC_SIGNAL_CH_NUMBER (4U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
extern volatile uint16_t u16ADCRefVoltage;
extern const uint8_t u8ADCChList[];
/* Exported functions --------------------------------------------------------*/
extern void Analog_Signal_Conv_Init(void);
extern void Analog_Signal_Conv_Stop(void);
extern void Analog_Signal_Conv_Service(void);
extern uint16_t ADC_Read_Signal(uint8_t u8ADCCh);
extern uint8_t ADC_Read_Signal_Valid(uint8_t u8ADCCh);
extern uint16_t ADC_Conv_Single_Channel(uint8_t u8ADCCh);
/*! @} */
#ifdef __cplusplus
}
#endif
#endif /* ANALOG_SIGNALS_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************************
文 件 名:Simulated_IIC_Master.h
功能描述:IO端口模拟的IIC(I2C)主机函数库头文件
作 者:张暄
版 本:V1.0
日 期:2016.12.21
******************************************************************************/
#ifndef _SIMULATED_IIC_MASTER_H_
#define _SIMULATED_IIC_MASTER_H_
#include "common.h"
/******************************************************************************
1us延时校准
******************************************************************************/
#define IIC_FREQ_CALIBRATION 4
/******************************************************************************
确认信号
******************************************************************************/
#define IIC_ACK 0 //肯定应答
#define IIC_NAK 1 //否定应答
#define IIC_INVALID_ACK 2 //无效的应答信号(应答信号还未收到)
/******************************************************************************
函数声明
******************************************************************************/
void LtDet_IIC_Init(void);
void LtDet_IIC_Start(void);
void LtDet_IIC_Stop(void);
void LtDet_IIC_Transmit_Data(uint8_t Data);
uint8_t LtDet_IIC_Receive_Data(void);
void LtDet_IIC_Transmit_ACK(uint8_t ACK);
uint8_t LtDet_IIC_Receive_ACK(void);
void LtDet_IIC_Delay(void);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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