Commit d7307d2b authored by 时昊's avatar 时昊

feat:删除燃油和水温功能

parent c9ece335
......@@ -3,7 +3,6 @@ SET CPU_TYPE=BAT32G139GK64FB
SET CPU_VENDOR=Cmsemicon
SET UV2_TARGET=RMR42E
SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_fuel.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\backlight.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_espeed.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_vspeed.__i"
......@@ -14,7 +13,6 @@ SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\gui_display.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\can_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\can_app.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_coolant.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_tpms.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\faultcode.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\data_voltage.__i"
......
......@@ -383,16 +383,6 @@
<Group>
<GroupName>Application</GroupName>
<Files>
<File>
<FileName>Data_Fuel.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Fuel\Data_Fuel.c</FilePath>
</File>
<File>
<FileName>Data_Fuel.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Fuel\Data_Fuel.h</FilePath>
</File>
<File>
<FileName>BackLight.c</FileName>
<FileType>1</FileType>
......@@ -503,16 +493,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\CAN_User\Can_App.h</FilePath>
</File>
<File>
<FileName>Data_Coolant.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Coolant\Data_Coolant.c</FilePath>
</File>
<File>
<FileName>Data_Coolant.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Data_Coolant\Data_Coolant.h</FilePath>
</File>
<File>
<FileName>Data_TPMS.c</FileName>
<FileType>1</FileType>
......
......@@ -3,7 +3,7 @@
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'TianYing'
* Project: 'RMR42E'
* Target: 'RMR42E'
*/
......
......@@ -2,7 +2,6 @@
#define APPLICATION_H__
#include "Fuel\Data_Fuel.h"
#include "GPIO_USER\GpioUser.h"
#include "BackLight\BackLight.h"
#include "Data_VSpeed\Data_VSpeed.h"
......@@ -14,7 +13,6 @@
#include "CAN_APP\CAN_CH0_CAN_Communication_Matrix.h"
#include "Can_User/Can_User.h"
#include "Can_User/Can_App.h"
#include "Data_Coolant/Data_Coolant.h"
#include "Data_TPMS/Data_TPMS.h"
#include "Data_Voltage/Data_Voltage.h"
#include "FaultCode/FaultCode.h"
......
......@@ -34,31 +34,8 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
p6EE->Msg [ i ] = 0xFFu;
}
}
p6EE -> Sig.Vsppe_H3_TX = (Vspeed_tx >> 8) & 0x7u ;
p6EE -> Sig.Vsppe_L8_TX = Vspeed_tx & 0xFF ;
p6EE -> Sig.ODO_TX_H = (ODO_tx >> 16) & 0xFF ;
p6EE -> Sig.ODO_TX_M = (ODO_tx >> 8) & 0xFF ;
p6EE -> Sig.ODO_TX_L = ODO_tx & 0xFF ;
p6EE -> Sig.Uint_TX = Get_Dis_KM_Unit() ;
p6EE -> Sig.Coolant_Seg_TX = GET_DataCoolantTempSegDisp() ;
if (GET_DataCollantTempWarnflg() == 2)
{
p6EE -> Sig.Coolant_Warn_TX = 1;
}
else
{
p6EE -> Sig.Coolant_Warn_TX = 0;
}
p6EE -> Sig.Fuel_Seg_TX = Get_CurFuelSetp() ;
if(Get_Fuel_RES() > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
}
else
{
p6EE -> Sig.Fuel_Res_TX = Get_Fuel_RES() ;
}
}
void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
......@@ -80,7 +57,7 @@ void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
p6EF -> Sig.Espeed_TX = Espeed_tx;
p6EF -> Sig.TripA_H = (TripA_tx >> 8) & 0xFF;
p6EF -> Sig.TripA_L = TripA_tx & 0xFF;
p6EF -> Sig.Coolant_TX = GET_DataCoolantTempValueDisp() + 40;
}
void Can_Set_Buff_450(canlib_uint8_t CopyData[])
{
......
#include "Data_Coolant\Data_Coolant.h"
#include "Application.h"
DataCoolantTempStruct DataCoolantTemp ;
DataCoolantTempDisStruct DataCoolantTemp_Dis;
void Data_Coolant_Temp_KL30_Init ( void )
{
DataCoolantTemp.Value = 0;
DataCoolantTemp.Valid = 0;
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
void Data_Coolant_Temp_KL15_Init ( void )
{
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
void Data_Coolant_Temp_Processing_Service ( void )
{
uint16_t Coolant_Temperature;
uint8_t Coolant_Temperature_State;
uint32_t Temp;
uint8_t i;
Coolant_Temperature = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature();
Coolant_Temperature_State = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State();
if (SYS_OPR_STAT_IGN_ON )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
else
{
if(Coolant_Temperature_State == 1)
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
else
{
DataCoolantTemp.Valid = 1;
if(Coolant_Temperature >= 2730)
{
Coolant_Temperature -= 2730;
}
else
{
Coolant_Temperature = 0;
}
if ((Coolant_Temperature % 10) >= 5)
{
Coolant_Temperature += 5;
}
if(Coolant_Temperature > 1990)
{
Coolant_Temperature = 1990 ;
}
DataCoolantTemp.Value = Coolant_Temperature / 10;
}
}
}
else
{
DataCoolantTemp.Valid = 0;
DataCoolantTemp.Value = 0;
}
//显示
Data_Coolant_Temp_Display();
}
void Data_Coolant_Temp_Display ( void )
{
if(SYS_OPR_STAT_IGN_ON)
{
if (Common_GetIgnOnTime() < 3000)
{
DataCoolantTemp_Dis.u8_Uptimer = CoolantSelfCheckFlashtimer;
DataCoolantTemp_Dis.u8_Downtimer = CoolantSelfCheckFlashtimer;
if(DataCoolantTemp_Dis.u8_CurSeg == 0)
{
DataCoolantTemp_Dis.u8_DestSeg = 5;
}
if(DataCoolantTemp_Dis.u8_CurSeg == 5)
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
DataCoolantTemp_Dis.Dis_Valid = 0;
}
else
{
DataCoolantTemp_Dis.u8_Uptimer = CoolantFlashtimer;
DataCoolantTemp_Dis.u8_Downtimer = CoolantFlashtimer;
Get_Coolant_Temp_Seg(DataCoolantTemp.Value);
if(DataCoolantTemp.Valid == 0)
{
DataCoolantTemp_Dis.Dis_Valid = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
DataCoolantTemp_Dis.u8_CurSeg = 0;
DataCoolantTemp_Dis.u8_DestSeg = 0 ;
DataCoolantTemp_Dis.u8_Flg = 0;
}
else
{
DataCoolantTemp_Dis.Dis_Valid = 1;
if (DataCoolantTemp_Dis.u8_Flg == 2)
{
DataCoolantTemp_Dis.u8_Flg = 1;
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
}
else if(DataCoolantTemp_Dis.u8_Flg == 0)
{
DataCoolantTemp_Dis.u8_Flg = 2;
DataCoolantTemp_Dis.u8_CurSeg = DataCoolantTemp_Dis.u8_DestSeg;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
}
}
}
if(DataCoolantTemp_Dis.u8_CurSeg > DataCoolantTemp_Dis.u8_DestSeg )
{
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_DownFlashtimer++;
if(DataCoolantTemp_Dis.u8_DownFlashtimer >= DataCoolantTemp_Dis.u8_Downtimer)
{
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_CurSeg --;
}
}
else if(DataCoolantTemp_Dis.u8_CurSeg < DataCoolantTemp_Dis.u8_DestSeg)
{
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer++;
if(DataCoolantTemp_Dis.u8_UpFlashtimer >= DataCoolantTemp_Dis.u8_Uptimer)
{
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_CurSeg ++;
}
}
//warning
if( DataCoolantTemp.Valid == 0 )
{
DataCoolantTemp_Dis.u8_Warnflg = 1;
}
else
{
if (DataCoolantTemp.Value >= 115)
{
DataCoolantTemp_Dis.u8_Warnflg = 2;
}
else if(DataCoolantTemp.Value <= 112)
{
DataCoolantTemp_Dis.u8_Warnflg = 0;
}
else
{
;
}
}
}
else
{
DataCoolantTemp_Dis.Dis_Valid = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = DataCoolantTemp_Dis.u8_Uptimer;
DataCoolantTemp_Dis.u8_DownFlashtimer = DataCoolantTemp_Dis.u8_Downtimer;
DataCoolantTemp_Dis.u8_Warnflg = 0;
DataCoolantTemp_Dis.u8_Flg = 0;
}
}
void Get_Coolant_Temp_Seg(uint16_t Temp_Value)
{
uint8_t TempSeg;
uint8_t CurTempSeg;
if(Temp_Value < 50)
{
if(DataCoolantTemp_Dis.u8_CurSeg > 1)
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
else if (DataCoolantTemp_Dis.u8_CurSeg > 0)
{
if(Temp_Value <= 47)
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 0;
}
}
else if((Temp_Value < 62)&&(Temp_Value >= 50))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 2)
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 1 )
{
if(Temp_Value <= 59)
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 1;
}
}
else if((Temp_Value < 80)&&(Temp_Value >= 62))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 3)
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 2)
{
if(Temp_Value <= 77)
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 2;
}
}
else if((Temp_Value < 98)&&(Temp_Value >= 80))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 4)
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
else if(DataCoolantTemp_Dis.u8_CurSeg > 3)
{
if(Temp_Value <= 95 )
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 3;
}
}
else if((Temp_Value < 115)&&(Temp_Value >= 98))
{
if(DataCoolantTemp_Dis.u8_CurSeg > 4)
{
if(Temp_Value <= 112)
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 4;
}
}
else
{
DataCoolantTemp_Dis.u8_DestSeg = 5;
}
}
//水温显示格数
uint8_t GET_DataCoolantTempSegDisp(void)
{
return DataCoolantTemp_Dis.u8_CurSeg;
}
//水温显示有效标志
uint8_t GET_DataCollantTempSegValid(void)
{
return DataCoolantTemp_Dis.Dis_Valid;
}
//水温数显。作为外发使用的时候+40
uint16_t GET_DataCoolantTempValueDisp(void)
{
return DataCoolantTemp.Value ;
}
uint8_t GET_DataCollantTempValueValid(void)
{
return DataCoolantTemp.Valid;
}
//水温灯及显示的报警信号 0:无报警,正常显示 1:掉线或者state无效,白色闪烁 2:高温,红色闪烁
uint8_t GET_DataCollantTempWarnflg(void)
{
return DataCoolantTemp_Dis.u8_Warnflg;
}
#ifndef _DATA_Coolant_H_
#define _DATA_Coolant_H_
#include "common.h"
#define CoolantFlashtimer 250
#define CoolantSelfCheckFlashtimer 15
/*** 控制结构 ***/
typedef struct __attribute__((aligned(4)))
{
uint8_t Dis_Valid;
uint8_t u8_DestSeg;
uint8_t u8_CurSeg;
uint8_t u8_UpFlashtimer ;
uint8_t u8_DownFlashtimer ;
uint8_t u8_Uptimer ;
uint8_t u8_Downtimer ;
uint8_t u8_Flashflg;
uint8_t u8_Warnflg;
uint8_t u8_Flg;
}DataCoolantTempDisStruct;
extern DataCoolantTempDisStruct DataCoolantTemp_Dis;
typedef struct __attribute__((aligned(4)))
{
uint16_t Value;
uint8_t Valid;
}DataCoolantTempStruct; //水温数据结构
void Data_Coolant_Temp_KL30_Init(void);
void Data_Coolant_Temp_KL15_Init(void);
void Data_Coolant_Temp_Processing_Service(void);
void Get_Coolant_Temp_Seg(uint16_t Temp_Value);
void Data_Coolant_Temp_Display ( void );
uint8_t GET_DataCollantTempSegValid(void);
uint8_t GET_DataCoolantTempSegDisp(void);
uint16_t GET_DataCoolantTempValueDisp(void);
uint8_t GET_DataCollantTempWarnflg(void);
extern DataCoolantTempStruct DataCoolantTemp ;
#endif
This diff is collapsed.
#ifndef DATA_FUEL_H
#define DATA_FUEL_H
#include "Components.h"
typedef enum __attribute__((aligned(4)))
{
FuelSensorNormal = 0,
FuelSensorShortCircuit,
FuelSensorOpenCircuit,
}FuelSensorSts_t;
extern void Fuel_KL15_Init(void);
extern void Fuel_KL30_Init(void);
extern void Fuel_Cal_Sevice(uint8_t deltaTime);
extern uint8_t Get_Fuel_Disp_Byte(void);
extern uint8_t Get_CurFuelSetp(void);
extern FuelSensorSts_t Get_Fuel_Sensor_State(void);
uint16_t Get_Fuel_RES(void);
#endif
......@@ -93,11 +93,7 @@ void Gauge_Service(void)
{
LED_Driver_Channel_Set(LampChannel_0, k, LED_OFF);
}
//LED_Driver_Channel_Set(LampChannel_0, LampCh0_35_ODO, LED_OFF);
//LED_Driver_Channel_Set(LampChannel_0, LampCh0_34_TRIP, LED_OFF);
//LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Screen_Time, LED_OFF);
//LED_Driver_Channel_Set(LampChannel_0, LampCh0_08_KMH, LED_OFF);
//LED_Driver_Channel_Set(LampChannel_0, LampCh0_09_MPH, LED_OFF);
}
}
else
......@@ -106,11 +102,7 @@ void Gauge_Service(void)
{
if (Common_GetIgnOnTime() >= 3000)
{
//for(i = 0; i < BU98R10_DDRAM_SIZE; i ++)
//{
// BU98R10Chip0DDRAM.Byte[i] = 0x77;
// BU98R10Chip1DDRAM.Byte[i] = 0x77;
//}
if (VSpeed_Count < 3)
{
......@@ -124,9 +116,7 @@ void Gauge_Service(void)
SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(Get_Dis_KM_Unit(), Get_ODO_Value() / 10u, Get_Trip_Value());
Gauge_Clock_Display();
SEG_SET_FuelDial(1, Get_CurFuelSetp());
SEG_SET_EspeedDial(1, Get_DispEngineSpeed()/500);
SEG_SET_CoolantDial(1, GET_DataCoolantTempSegDisp(), GET_DataCoolantTempValueDisp(), GET_DataCollantTempSegValid());
SEG_SET_Voltage_NUM(1, Get_Battery_Voltage());
#if(IC_Current == TY200_080000b_ty)
SEG_SET_TPMS_NUM(1, Get_Front_TPMS_Sig_Value(), Get_Rear_TPMS_Sig_Value(), Get_Dis_Tpms_Unit(),Get_Front_TPMS_Sig_Vaild(), Get_Rear_TPMS_Sig_Vaild());
......
......@@ -969,109 +969,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
*/
void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
{
if (m_Flag == 1u)
{
IC2_SEG107 = IC_SEG_ON;
IC2_SEG106 = IC_SEG_GREY;
IC2_SEG105 = IC_SEG_GREY;
IC2_SEG104 = IC_SEG_GREY;
IC2_SEG102 = IC_SEG_GREY;
IC2_SEG101 = IC_SEG_GREY;
if (((Get_Fuel_Sensor_State() == 2) || (Get_Fuel_Sensor_State() == 1))&& (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
{
if (FLASH_SYNC_1Hz)
{
IC2_SEG106 = IC_SEG_ON;
IC2_SEG105 = IC_SEG_ON;
IC2_SEG104 = IC_SEG_ON;
IC2_SEG102 = IC_SEG_ON;
IC2_SEG101 = IC_SEG_ON;
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
}
else
{
IC2_SEG106 = IC_SEG_GREY;
IC2_SEG105 = IC_SEG_GREY;
IC2_SEG104 = IC_SEG_GREY;
IC2_SEG102 = IC_SEG_GREY;
IC2_SEG101 = IC_SEG_GREY;
IC2_SEG108 = IC_SEG_GREY;
IC2_SEG100 = IC_SEG_GREY;
}
}
else
{
if((Get_CurFuelSetp() == 0) && (Common_GetIgnOnTime() >= 3000))
{
if (FLASH_SYNC_1Hz)
{
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
}
else
{
IC2_SEG108 = IC_SEG_GREY;
IC2_SEG100 = IC_SEG_GREY;
}
}
else
{
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
}
if ((Get_CurFuelSetp() == 1) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
{
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
if (FLASH_SYNC_1Hz)
{
IC2_SEG106 = IC_SEG_ON;
}
else
{
IC2_SEG106 = IC_SEG_GREY;
}
}
else
{
switch (m_SEG)
{
case 5u:
IC2_SEG101 = IC_SEG_ON;
case 4u:
IC2_SEG102 = IC_SEG_ON;
case 3u:
IC2_SEG104 = IC_SEG_ON;
case 2u:
IC2_SEG105 = IC_SEG_ON;
case 1u:
IC2_SEG106 = IC_SEG_ON;
case 0u:
break;
default:
break;
}
}
}
}
else
{
IC2_SEG108 = IC_SEG_OFF;
IC2_SEG106 = IC_SEG_OFF;
IC2_SEG105 = IC_SEG_OFF;
IC2_SEG104 = IC_SEG_OFF;
IC2_SEG102 = IC_SEG_OFF;
IC2_SEG101 = IC_SEG_OFF;
IC2_SEG107 = IC_SEG_OFF;
IC2_SEG100 = IC_SEG_OFF;
}
}
......
......@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/3/31 13:14:40
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
......@@ -15,7 +15,7 @@
#include "Analog_Signals.h"
/* Private typedef ----------------------------------------------------------*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8Ch;
uint8_t u8RefType;
......@@ -26,7 +26,7 @@ typedef struct
ADC_Circuit_Calc_Func pfProcFunc;
}ADC_Ch_Cfg_st_t;
typedef enum ASigConvStat
typedef __attribute__((aligned(4))) enum ASigConvStat
{
ADC_STAT_IDLE = 0,
ADC_STAT_INIT,
......@@ -36,7 +36,7 @@ typedef enum ASigConvStat
ADC_STAT_ERR,
}ADC_Stat_en_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
ADC_Stat_en_t enStatus;
uint8_t u8CurrentCh;
......@@ -44,7 +44,7 @@ typedef struct
uint8_t u8Timer;
}ADC_Ctrl_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8Valid;
uint8_t u8Rsvd;
......@@ -72,25 +72,21 @@ ADC_Ctrl_st_t stADCCtrl;
uint16_t u16ADCSample[ADC_CONV_CH_NUMBER];
ADC_Data_st_t stADCData[ADC_SIGNAL_CH_NUMBER];
const uint8_t u8ADCChList[ADC_CONV_CH_NUMBER] =
const uint8_t __attribute__((aligned(4))) u8ADCChList[ADC_CONV_CH_NUMBER] =
{
2U, 3U, 7U, 5U,
2U, 3U,
};
const ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBER] =
const __attribute__((aligned(4))) ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBER] =
{
{ 0U, 0U, 0U, 0U, 700U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 0U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 1U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 2U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit101,},
{ 3U, 2U, 0U, 2U, 18U, 1U, ADC_Res_Calc_Circuit101,},
};
const ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_NUMBER] =
const __attribute__((aligned(4))) ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_NUMBER] =
{
{ 3300000U, 1000000U, 0U, 0U,},
{ 3300000U, 1000000U, 0U, 0U,},
{ 0U, 0U, 0U, 0U,},
{ 0U, 0U, 2000U, 300U,},
};
/* Private function prototypes ----------------------------------------------*/
......@@ -115,10 +111,11 @@ void Analog_Signal_Conv_Init(void)
}
}
RTE_ADC_Init(0,2);
RTE_ADC_Init(0,3);
RTE_ADC_Init(0,5);
RTE_ADC_Init(0,7);
for (i = 0U; i < ADC_CONV_CH_NUMBER; i++)
{
RTE_ADC_Init(0, u8ADCChList[i]);
}
for (i = 0U; i < ADC_SIGNAL_CH_NUMBER; i++)
{
......
......@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/3/31 13:14:40
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
......@@ -30,13 +30,11 @@ 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_TOTAL_CH_NUMBER (2U)
#define ADC_SIGNAL_CH_NUMBER (2U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
......
......@@ -60,14 +60,14 @@ static void Power_KL30_Init(void)
Checkself_Init();
Data_Vehicle_Speed_KL30_Init();
Data_Engine_Speed_KL30_Wakeup_Init();
Data_Coolant_Temp_KL30_Init();
LINE_IN_Init();
Key_KL30_Init_EXample();
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
Data_Voltage_Init();
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
......@@ -121,7 +121,7 @@ static void Power_Wakeup_Init(void)
Protocol_KL30_Wakeup_Init();
Uart0_Init(115200);
BlueTooth_KL30_KL15_Wakeup_Init();
Fuel_KL30_Init();
Data_Voltage_Init();
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
......@@ -159,10 +159,10 @@ static void Power_IG_ON_Init(void)
Line_In_KL15_ON_Init();
Telltales_KL15_Init();
Telltales_UserInit();
Fuel_KL15_Init();
Data_Voltage_Init();
MenuData_TCS_Init();
Data_Coolant_Temp_KL15_Init();
BlueTooth_KL30_KL15_Wakeup_Init();
Data_TPMS_KL15_WAKE_UP_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
......
......@@ -223,125 +223,21 @@ static void LED_Oil_Pressure_Execution(Tellib_uint16_t led_status)
static Tellib_uint16_t LED_Fuel_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Common_GetIgnOnTime() >= 3000)
{
if(Get_Fuel_Sensor_State() == FuelSensorNormal)
{
if(Get_CurFuelSetp() > 1)
{
LED_STATE = 3;//白灯
}
else
{
LED_STATE = 2;//格小于等于1,黄灯闪
}
}
else
{
LED_STATE = 2;//开路,黄灯闪
}
}
else
{
LED_STATE = 1; //黄灯常亮
}
return LED_STATE;
}
static void LED_Fuel_Execution(Tellib_uint16_t led_status)
{
if ( led_status == 3u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_21_Fuel_W, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_20_Fuel_Y, LED_OFF);
SEG_SET_LED_STS(em_SEG_Fuel,1);
}
else if ( led_status == 2u )
{
if (FLASH_SYNC_1Hz)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_20_Fuel_Y, LED_ON);
SEG_SET_LED_STS(em_SEG_Fuel,1);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_20_Fuel_Y, LED_OFF);
SEG_SET_LED_STS(em_SEG_Fuel,0);
}
LED_Driver_Channel_Set(LampChannel_0, LampCh0_21_Fuel_W, LED_OFF);
}
else if ( led_status == 1u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_20_Fuel_Y, LED_ON);
SEG_SET_LED_STS(em_SEG_Fuel,1);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_21_Fuel_W, LED_OFF);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_21_Fuel_W, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_20_Fuel_Y, LED_OFF);
//SEG_SET_LED_STS(em_SEG_Fuel,0);
}
}
static Tellib_uint16_t LED_Coolant_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if(GET_DataCollantTempWarnflg() == 2)
{
LED_STATE = 2;
}
else if (GET_DataCollantTempWarnflg() == 1)
{
LED_STATE = 3;
}
else
{
LED_STATE = 1;
}
return LED_STATE;
}
static void LED_Coolant_Execution(Tellib_uint16_t led_status)
{
if ( led_status == 2u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_13_Temp_AlarmW, LED_OFF);
if (FLASH_SYNC_1Hz)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_11_Temp_AlarmR, LED_ON);
SEG_SET_LED_STS(em_SEG_Coolant, 1);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_11_Temp_AlarmR, LED_OFF);
SEG_SET_LED_STS(em_SEG_Coolant, 0);
}
}
else if ( led_status == 3u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_11_Temp_AlarmR, LED_OFF);
if (FLASH_SYNC_1Hz)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_13_Temp_AlarmW, LED_ON);
SEG_SET_LED_STS(em_SEG_Coolant, 1);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_13_Temp_AlarmW, LED_OFF);
SEG_SET_LED_STS(em_SEG_Coolant, 0);
}
}
else if ( led_status == 1u )
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_13_Temp_AlarmW, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_11_Temp_AlarmR, LED_OFF);
SEG_SET_LED_STS(em_SEG_Coolant, 1);
}
else
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_13_Temp_AlarmW, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_11_Temp_AlarmR, LED_OFF);
SEG_SET_LED_STS(em_SEG_Coolant, 0);
}
}
static Tellib_uint16_t LED_Bluetooth_Judgement(void)
{
......
......@@ -4,8 +4,9 @@
#include "cgc.h"
#include "gpio.h"
#include "isr.h"
#include "Analog\Analog_Signals.h"
uint8_t u8NewChNum[4] = {2, 3, 7, 5};
// uint8_t u8NewChNum[4] = {2, 3, 7, 5};
void RTC_ADC_Interrupt(void *msg)
{
......@@ -17,6 +18,7 @@ void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum)
{
GPIO_InitTypeDef GPIO_InitStructure = {0};
ADC_InitTypeDef ADC_InitStructure = {0};
if(u8ChNum<=7)
{
......@@ -133,13 +135,13 @@ void RTE_ADC_Get_Conversion_Result(uint16_t *pu16Data, uint8_t u8ChNum)
uint8_t i;
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= 4U))
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= ADC_TOTAL_CH_NUMBER))
{
if (RTE_ADC_Get_Conversion_Status() == 0U)
{
for (i = 0U; i < u8ChNum; i++)
{
ADC_Converse(u8NewChNum[i], 1, pu16Data);
ADC_Converse((ADC_Channel_t)u8ADCChList[i], 1, pu16Data);
pu16Data++;
}
}
......
......@@ -4,6 +4,8 @@
#include <stdint.h>
extern const uint8_t u8ADCChList[];
#define ADC_RESOLUTION (4096U) /* 12bit ADC */
extern void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum);
......
......@@ -47,7 +47,7 @@ void Sys_10ms_Tasks(void)
Data_Mileage_Write_EEPROM();
Can_BusOff_Recover(10u);
Turn_Left_Right_Lamp();
Fuel_R_Cal(10u);
TYW_Check_Count();
Data_TPMS_Processing_Service();
Protocol_Service();
......@@ -61,7 +61,7 @@ void Sys_20ms_Tasks(void)
Key_Auto_Save();
Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service();
Data_Coolant_Temp_Processing_Service();
}
......@@ -85,7 +85,7 @@ void Sys_100ms_Tasks(void)
counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
}
Fuel_Cal_Sevice(100u);
BackLight_Process();
Services_Mileage_Callback();
Data_Voltage_Processing_Service();
......
/**************************************************************************//**
* \file Analog_Signals.h
* \brief Analog signal processing
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
*
******************************************************************************/
#ifndef ANALOG_SIGNALS_H__
#define ANALOG_SIGNALS_H__
/* Includes -----------------------------------------------------------------*/
#include "ADC.h"
#include "Analog_Circuits.h"
#include "RTE.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,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (2U)
#define ADC_SIGNAL_CH_NUMBER (2U)
#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.
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