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

Merge branch 'lijianshuang' into 'dev'

🐞 fix:统一使用同一个igon判断条件

See merge request !87
parents 191e0e58 a3c64709
......@@ -738,26 +738,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Analog\Analog_Signals.h</FilePath>
</File>
<File>
<FileName>Light_Sensor.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor.h</FilePath>
</File>
<File>
<FileName>Light_Sensor_Interface.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_Interface.c</FilePath>
</File>
<File>
<FileName>Light_Sensor_Interface.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_Interface.h</FilePath>
</File>
<File>
<FileName>Light_Sensor_V1.0.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_V1.0.lib</FilePath>
</File>
<File>
<FileName>CAN_Lib.h</FileName>
<FileType>5</FileType>
......
SET PATH=C:\Keil_v5\ARM\ARMCC\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\tyw05\AppData\Local\Microsoft\WindowsApps;
SET ARMCC5_ASMOPT=--diag_suppress=9931
SET ARMCC5_CCOPT=--diag_suppress=9931
SET ARMCC5_LINKOPT=--diag_suppress=9931
SET CPU_TYPE=BAT32G139GK64FB
SET CPU_VENDOR=Cmsemicon
SET UV2_TARGET=TianYing200
......@@ -34,7 +31,6 @@ SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\simulated_iic_2_master.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\analog_circuits.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\analog_signals.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\light_sensor_interface.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\powermanag_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\system_monitor_user.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\telltales_user.__i"
......@@ -58,4 +54,36 @@ SET CPU_CLOCK=0x00B71B00
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\adc.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\can.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\cgc.__i"
"C:\Keil
\ No newline at end of file
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\cmp.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\dac.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\delay.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\dma.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\elc.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\epwm.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\flash.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\gpio.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\i2c.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\i2ca.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\interval.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\intp.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\key.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\pcbz.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\pga.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\rtc.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\sci_common.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\sspi.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\tim.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\tima.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\timb.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\timm.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\uart.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\wdt.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\isr.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\docan_iso15765.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\uds_iso14229_server.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\uds_iso14229_services.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\isr_bat32g139.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmAsm" --Via ".\objects\startup_bat32g139._ia"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmCC" --Via ".\objects\system_bat32g139.__i"
"C:\Keil_v5\ARM\ARMCC\Bin\ArmLink" --Via ".\Objects\TianYing.lnp"
"C:\Keil_v5\ARM\ARMCC\Bin\fromelf.exe" ".\Objects\TianYing.axf" --i32combined --output ".\Objects\TianYing.hex"
......@@ -21,7 +21,7 @@ void BackLight_Init(void)
void BackLight_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
if (Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
//if (Line_In_Get_Status(LINE_IN_Little_Lamp))
//{
......@@ -48,7 +48,7 @@ void BackLight_Process(void)
// }
//}
//if ( LED_Turnon == 5 )
if (Common_GetIgnOnTime() >= 3000)
if (Common_GetIgnOnTime() >= 3030)
{
if (Line_In_Get_Status(LINE_IN_Little_Lamp))
{
......
......@@ -2,7 +2,7 @@
#define _BACKLIGHT_H_
#include "common.h"
#include "Application.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Duty;
uint8_t Cycle;
......
......@@ -14,6 +14,8 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
CANMsg220Union *p220;
uint8_t i = 0;
uint8_t u8TCSVal = 0;
u8TCSVal = Get_Dis_Tcs_Val();
p220 = (CANMsg220Union *)CopyData;
if ( p220 != ( void * )0 )
......@@ -23,9 +25,9 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
p220->Msg [ i ] = 0x0u;
}
p220 -> Sig.TCS_TX = Get_Dis_Tcs_Val();
p220 -> Sig.TCS_TX = u8TCSVal;
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (Get_Dis_Tcs_Val() == 1) ? 8 : 0;
p220 -> Sig.CheckSum = (u8TCSVal == 1) ? 8 : 0;
}
......@@ -36,8 +38,10 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
CANMsg6EEUnion *p6EE;
uint8_t i = 0;
uint16_t Vspeed_tx = 0;
uint16_t Fuel_tx = 0;
uint32_t ODO_tx = Data_ODO_Read();
Vspeed_tx = Get_DispVechileSpeed_TX()/10;
Fuel_tx = Get_Fuel_RES();
p6EE = (CANMsg6EEUnion *)CopyData;
if ( p6EE != ( void * )0 )
......@@ -49,13 +53,13 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
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 ;
if(Get_Fuel_RES() > 255)
if(Fuel_tx > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
}
else
{
p6EE -> Sig.Fuel_Res_TX = Get_Fuel_RES() ;
p6EE -> Sig.Fuel_Res_TX = Fuel_tx ;
}
}
......@@ -105,6 +109,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
uint16_t u16FrontTpms = 0;
uint16_t u16RearTpms = 0;
uint16_t u16FrontTpmsValue = Get_Front_TPMS_TX();
uint16_t u16RearTpmsValue = Get_Rear_TPMS_TX();
p450 = (CANMsg450Union *)CopyData;
if ( p450 != ( void * )0 )
{
......@@ -122,9 +129,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
if((Get_Front_TPMS_TX() + 146) <= 1000U)
if((u16FrontTpmsValue + 146) <= 1000U)
{
u16FrontTpms = (Get_Front_TPMS_TX() + 146);
u16FrontTpms = (u16FrontTpmsValue + 146);
}
else
{
......@@ -143,9 +150,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
if((Get_Rear_TPMS_TX() + 146) <= 1000U)
if((u16RearTpmsValue + 146) <= 1000U)
{
u16RearTpms = (Get_Rear_TPMS_TX() + 146);
u16RearTpms = (u16RearTpmsValue + 146);
}
else
{
......@@ -163,7 +170,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
{
CANMsg580Union *p580;
uint8_t i = 0;
uint8_t u8TpmsFlag = Get_Tpms_TX_Flag() ;
p580 = (CANMsg580Union *)CopyData;
if ( p580 != ( void * )0 )
{
......@@ -172,7 +179,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
p580->Msg [ i ] = 0x0u;
}
if(Get_Tpms_TX_Flag() == 1)
if(u8TpmsFlag == 1)
{
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
......@@ -192,7 +199,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
// CAN_TX_Count++;
//}
}
else if(Get_Tpms_TX_Flag() == 2)
else if(u8TpmsFlag == 2)
{
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
......
......@@ -22,7 +22,7 @@ Bus-off
#define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U
#define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Status;
uint8_t Timer;
......
......@@ -2,8 +2,8 @@
#define _COMMON_INTERFACE_H_
#include "Components.h"
#define TY200_080000b 0
#define TY200_080000b_ty 1
#define TY200_080000b 0 //不带胎压功能 TY100
#define TY200_080000b_ty 1 //带胎压功能 TY200
#define IC_Current TY200_080000b_ty //选择当前程序为哪个零件号的仪表
......
......@@ -197,7 +197,7 @@ void Data_Coolant_Temp_Processing_Service(void)
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 (Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
{
......@@ -253,9 +253,9 @@ void Data_Coolant_Temp_Processing_Service(void)
void Data_Coolant_Temp_Display ( void )
{
if(SYS_OPR_STAT_IGN_ON)
if(Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
if (Common_GetIgnOnTime() < 3000)
if (Common_GetIgnOnTime() < 3030)
{
DataCoolantTemp_Dis.u8_Uptimer = CoolantSelfCheckFlashtimer;
DataCoolantTemp_Dis.u8_Downtimer = CoolantSelfCheckFlashtimer;
......
......@@ -52,7 +52,7 @@ void Data_Engine_Speed_Processing_Service ( void )
Engine_Speed_State = Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State();
//第1步:获取实际转速值及转速有效性
if ( Common_Get_IG_Sts() == COMMON_POWER_ON )
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
if((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)||(Engine_Speed_State == 1))
{
......
......@@ -10,7 +10,8 @@ uint8_t Can_341_Flg = 0;
void Data_TPMS_KL30_Init ( void )
{
uint8_t TPMS_L[2] = {0,0};
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, TPMS_L , 2);
MenuData.TPMS_Front_Learn = TPMS_L[0];
MenuData.TPMS_Rear_Learn = TPMS_L[1];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
......@@ -38,7 +39,8 @@ void Data_TPMS_KL30_Init ( void )
void Data_TPMS_KL15_WAKE_UP_Init ( void )
{
uint8_t TPMS_L[2] = {0,0};
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1);
eeprom_ReadRecord(EEPROM_BLOCK_09, TPMS_L , 2);
MenuData.TPMS_Front_Learn = TPMS_L[0];
MenuData.TPMS_Rear_Learn = TPMS_L[1];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
......@@ -338,7 +340,8 @@ void Data_TPMS_Processing_Service ( void )
MenuData.TPMS_Front_Learn = TPMS.TPMS_Front_Learn;
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMS_L, 2);
}
......@@ -347,7 +350,8 @@ void Data_TPMS_Processing_Service ( void )
MenuData.TPMS_Rear_Learn = TPMS.TPMS_Rear_Learn;
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMS_L, 2);
}
......
......@@ -79,7 +79,7 @@ void Data_Vehicle_Speed_Processing_Service(void)
ESC_VehicleSpeedState = Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed_State( );
// 第1步:获取实际车速值及车速有效性
if( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
if( Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
{
......
......@@ -14,7 +14,7 @@ void Data_Voltage_Processing_Service ( void )
{
uint8_t voltage = 0;
uint8_t i = 0;
if ( Common_Get_IG_Sts() == COMMON_POWER_ON )
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x401_Msg_Count) == CAN_SIG_LOST)
{
......
......@@ -3,7 +3,7 @@
#include "common.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Buffer[30];
uint8_t Cnt;
......
......@@ -28,7 +28,7 @@ typedef uint32_t (*FaultCodeCallback)(void); /* 故障码回调函数 */
typedef uint16_t (*FaultCodeNumback)(void); /* 故障码个数回调函数 */
typedef uint16_t (*FaultCodeValidback)(void); /* 故障码有效回调函数 */
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint32_t u16FaultCode; /* 故障码 */
uint16_t u16FaultCodeCount; /* 故障码总数 */
......@@ -36,7 +36,7 @@ typedef struct
typedef struct
typedef struct __attribute__((aligned(4)))
{
FaultCodeCallback callbacks[NUM_FAULT_TYPES];
FaultCodeNumback FaultCodeNumCbk;
......
......@@ -274,7 +274,7 @@ void Fuel_Gauges_Cal(uint8_t deltaTime)
}
/*IGN ON 1秒/故障恢复后,开始走格 立即指向当前格 20220704*/
if (Common_GetIgnOnTime() >= 3000)
if (Common_GetIgnOnTime() >= 3030)
{
time += deltaTime;
if (FuelInitFlag)
......
......@@ -64,6 +64,74 @@ void Clear_Bu98(void)
uint8_t u8VspeedCount = 0;
void Gauge_Service(void)
{
static uint16_t VSpeed_Count = 0u;
uint8_t k = 0;
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
if (ClearODO_Flag == 1)
{
Check_SEG_Display();
for(k = 0; k < LampCh0_MAX; k ++)
{
if (k == LampCh0_24_Keys || k == LampCh0_21_Fuel_W || k == LampCh0_13_Temp_AlarmW || k == LampCh0_26_Tire_PressureW)
{
;
}
else
{
LED_Driver_Channel_Set(LampChannel_0, k, LED_ON);
}
}
}
else
{
if (Common_GetIgnOnTime() >= 3030)
{
if(u8VspeedCount < 3)
{
u8VspeedCount ++ ;
}
else
{
u8VspeedCount = 0;
SEG_SET_VSpeed_NUM(1u, Get_DispVechileSpeed( ) / 10u,Get_Dis_KM_Unit());
}
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_DataCoolantSegValue(), GET_DataCollantTempSegValid());
SEG_SET_Voltage_NUM(1, Get_Battery_Voltage());
#if(IC_Current == TY200_080000b_ty)
SEG_SET_TPMS_DISPLAY(1, Get_Front_TPMS_Sig_Value(), Get_Rear_TPMS_Sig_Value(), 0 ,Get_Front_TPMS_Sig_Vaild(), Get_Rear_TPMS_Sig_Vaild());
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04, LED_ON);
#endif
SEG_SET_Navigation_STS(Get_Navigation_St_Dis(),Get_Navigation_Code_Dis(),Get_Navigation_Mileage_Dis());
}
else
{
Checkself_SEG_Display();
}
}
}
else
{
Clear_Bu98();
for(k = 0; k < LampCh0_MAX; k ++)
{
LED_Driver_Channel_Set(LampChannel_0, k, LED_OFF);
}
}
}
#if 0
void Gauge_Service(void)
{
static uint16_t VSpeed_Count = 0u;
uint8_t k = 0;
......@@ -163,4 +231,4 @@ void Gauge_Service(void)
}
}
#endif
......@@ -5,13 +5,13 @@
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t value;
uint8_t segNum;
}PowerSegMap_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t value;
uint8_t segNum;
......@@ -19,7 +19,7 @@ typedef struct
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t Year;
uint8_t Month;
......
......@@ -338,7 +338,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
{
uint32_t Num = 0;
uint8_t m8 = 0;
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
IC2_SEG164 = IC_SEG_ON;
IC2_SEG165 = IC_SEG_ON;
......@@ -677,12 +677,12 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
break;
}
}
if ((m_Flag && BlueTooth.BLE_St) || (Common_GetIgnOnTime() < 3000) || ClearODO_Flag == 1)
if ((m_Flag && BlueTooth.BLE_St) || (Common_GetIgnOnTime() < 3030) || ClearODO_Flag == 1)
{
LED_Driver_Channel_Set(LampChannel_0, LampCh0_17_Length2, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_18_Length1, LED_ON);
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
IC1_SEG030 = IC_SEG_ON;
IC1_SEG130 = IC_SEG_ON;
......@@ -713,7 +713,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
{
Num = m_Mileage / 100000;
}
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
......@@ -782,7 +782,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
if (m_Mileage < 1000)
{
Num = m_Mileage / 100;
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
......@@ -794,7 +794,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
else
{
Num = ((m_Mileage + 50) / 100) % 1000 / 100;
if ((m_Mileage >= 10000) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((m_Mileage >= 10000) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
......@@ -863,7 +863,7 @@ void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage)
if (m_Mileage < 1000)
{
Num = (m_Mileage / 10) % 10;
if ((m_Mileage >= 10) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((m_Mileage >= 10) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
......@@ -1069,7 +1069,7 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
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 (((Get_Fuel_Sensor_State() == 2) || (Get_Fuel_Sensor_State() == 1)) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
if (FLASH_SYNC_1Hz)
{
......@@ -1097,7 +1097,7 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
else
{
if ((Get_CurFuelSetp() == 0) && (Common_GetIgnOnTime() >= 3000))
if ((Get_CurFuelSetp() == 0) && (Common_GetIgnOnTime() >= 3030))
{
if (FLASH_SYNC_1Hz)
{
......@@ -1115,7 +1115,7 @@ void SEG_SET_FuelDial(uint8_t m_Flag, uint8_t m_SEG)
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
}
if ((Get_CurFuelSetp() == 1) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((Get_CurFuelSetp() == 1) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
IC2_SEG108 = IC_SEG_ON;
IC2_SEG100 = IC_SEG_ON;
......@@ -1355,7 +1355,7 @@ void SEG_SET_CoolantDial(uint8_t m_Flag, uint8_t m_SEG, uint16_t m_Num, uint8_t
uint8_t m8;
if (m_Flag == 1u)
{
if ((m_flash == 0) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((m_flash == 0) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
if (FLASH_SYNC_1Hz)
{
......@@ -1400,7 +1400,7 @@ void SEG_SET_CoolantDial(uint8_t m_Flag, uint8_t m_SEG, uint16_t m_Num, uint8_t
default:
break;
}
if ((m_flash == 0) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((m_flash == 0) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
IC1_SEG128 = IC_SEG_OFF;
IC1_SEG125 = IC_SEG_OFF;
......@@ -1612,7 +1612,7 @@ void SEG_SET_VSpeed_NUM(uint8_t m_Flag, uint16_t m_NUM, uint8_t m_Unit)
RTE_GPIO_Set_Level(VSpeed_Hundreds, 0);
}
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
if (Get_Current_PageType() == Page_Km_Unit)
{
......@@ -1847,7 +1847,7 @@ void SEG_SET_Voltage_NUM(uint8_t m_Flag, uint16_t m_NUM)
{
IC1_SEG079 = IC_SEG_ON;
IC1_SEG086 = IC_SEG_ON;
if ((Get_Battery_Voltage_Valid() != 1) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((Get_Battery_Voltage_Valid() != 1) && (ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
IC1_SEG088 = IC_SEG_ON;
......@@ -1876,7 +1876,7 @@ void SEG_SET_Voltage_NUM(uint8_t m_Flag, uint16_t m_NUM)
else
{
Num = m_NUM / 100;
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() <= 3000))
if ((ClearODO_Flag == 1) || (Common_GetIgnOnTime() <= 3030))
{
m8 = SEG_DISPLAY_NUMBER0[Num];
}
......@@ -2091,7 +2091,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
{
IC2_SEG142 = IC_SEG_ON;
IC2_SEG122 = IC_SEG_ON;
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
//if (Get_Current_PageType() == Page_Tpms_Unit)
//{
......@@ -3341,7 +3341,7 @@ void SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(uint8_t m_Uint, uint32_t m_NUM_ODO, uint
uint8_t m8;
RTE_GPIO_Set_Level(ODO_TenThousand, 1);
RTE_GPIO_Set_Level(ODO_Thousand, 1);
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3000))
if ((ClearODO_Flag != 1) && (Common_GetIgnOnTime() >= 3030))
{
if ((Get_Current_PageType() == Page_Km_Unit) && ((Get_Current_PageMenu() == Page_Odo) || (Get_Current_PageMenu() == Page_Trip)))
{
......@@ -3431,7 +3431,7 @@ void SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(uint8_t m_Uint, uint32_t m_NUM_ODO, uint
LED_Driver_Channel_Set(LampChannel_0, LampCh0_34_TRIP, LED_ON);
}
if ((Get_Current_PageMenu() == Page_Odo) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3000))
if ((Get_Current_PageMenu() == Page_Odo) || (ClearODO_Flag == 1) || (Common_GetIgnOnTime() < 3030))
{
if (m_NUM_ODO > 99999)
{
......@@ -4480,9 +4480,9 @@ uint8_t Espeed_check_SEG_step = 0;
void SEG_Scan_SET_EspeedDial(void)
{
uint16_t a = 0;
a = (Espeed_check_SEG_step / 10) * 500;
a = (Espeed_check_SEG_step / 10) ;
SEG_SET_EspeedDial(1, a / 500);
SEG_SET_EspeedDial(1, a);
}
uint8_t check_SEG_step = 0;
......@@ -4524,9 +4524,7 @@ void Checkself_Init(void)
Espeed_check_SEG_step = 0;
fuel_check_SEG_step = 0;
}
//uint32_t u32NavigationCount = 0;
//uint32_t u32NavigationCount00 = 0;
//uint32_t u32NavigationCount11 = 1;
void Checkself_SEG_Display(void)
{
uint16_t Vspeed = 0;
......@@ -4539,41 +4537,7 @@ void Checkself_SEG_Display(void)
uint8_t min = 0;
uint32_t ODO = 0;
uint32_t Mileage = 0;
// uint32_t i = 0;
//SEG_SET_Navigation_Checkself(u32YZHDCount * 1111,u32YZHDCount22);
//u32NavigationCount00++;
//if (u32NavigationCount00 >= 3) // 500ms
//{
// u32NavigationCount00 = 0;
// if (u32NavigationCount11 == 1)
// {
// u32NavigationCount++;
// if (u32NavigationCount >= 9)
// {
// u32NavigationCount11 = 0;
// }
// }
// else
// {
// if (u32NavigationCount)
// {
// u32NavigationCount--;
// }
// else
// {
// u32NavigationCount11 = 1;
// //u32YZHDCount22 = 0;
// }
// }
//}
// for(i = 0; i < BU98R10_DDRAM_SIZE; i ++)
//{
// BU98R10Chip0DDRAM.Byte[i] = 1;
// BU98R10Chip1DDRAM.Byte[i] = 1;
// }
#if (1)
if (Common_GetIgnOnTime() >= 30)
{
if (Checkself_SEG_step_count < 60)
......@@ -4625,15 +4589,16 @@ void Checkself_SEG_Display(void)
#if (IC_Current == TY200_080000b_ty)
TPMS_dis = (Checkself_SEG_step / 3) * 11;
SEG_SET_TPMS_DISPLAY(1, TPMS_dis, TPMS_dis, 0, 1, 1);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04, LED_ON);
#endif
#endif
}
void TYW_Check_Count(void)
{
if ((ClearODO_Flag == 1) && (Common_Get_IG_Sts() == COMMON_POWER_ON))
if ((ClearODO_Flag == 1) && (Common_Get_IG_Sts( ) == COMMON_POWER_ON))
{
if (check_SEG_step < 249u)
{
......
......@@ -15,7 +15,7 @@
#include "Analog_Signals.h"
/* Private typedef ----------------------------------------------------------*/
typedef struct
typedef __attribute__((aligned(4))) struct
{
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 __attribute__((aligned(4))) struct
{
ADC_Stat_en_t enStatus;
uint8_t u8CurrentCh;
......@@ -44,7 +44,7 @@ typedef struct
uint8_t u8Timer;
}ADC_Ctrl_st_t;
typedef struct
typedef __attribute__((aligned(4))) struct
{
uint8_t u8Valid;
uint8_t u8Rsvd;
......@@ -72,20 +72,20 @@ 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,
};
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,},
{ 3U, 2U, 0U, 2U, 0U, 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,},
......@@ -115,10 +115,10 @@ 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++)
{
......
......@@ -22,8 +22,7 @@
#include "LED_Driver\Simulated_IIC_2_Master.h"
#include "LED_Driver\LED_Driver_Interface.h"
#include "LED_Driver\LED_Driver.h"
#include "Light_Sensor\Light_Sensor.h"
#include "Light_Sensor\Light_Sensor_Interface.h"
#include "Analog\Analog_Signals.h"
#include "Analog\Analog_Circuits.h"
#include "common.h"
......
......@@ -16,11 +16,11 @@ uint8_t Tpms_TX_Flag = 0;
//RTC_DateTypeDef RTC_DateStruct;
RTC_CounterTypeDef counter_val;
void Data_TCS_Set_OnOff(uint32_t u32Data)
void Data_TCS_Set_OnOff(uint8_t u8Data)
{
uint32_t u32Data1[1u] = {0};
u32Data1[0u] = u32Data;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, u32Data1, 1u);
uint8_t u8Data1[1u] = {0};
u8Data1[0u] = u8Data;
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u8Data, 1);
}
void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
......@@ -28,18 +28,18 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
switch (enKeyEvent)
{
case KEY_EVENT_SHORT_PRESS_1://1s
if (Common_GetIgnOnTime() >= 3000)
if (Common_GetIgnOnTime() >= 3030)
{
Key_Left_Short_Press();
}
Key_Clear_Time();
break;
case KEY_EVENT_SHORT_PRESS_2://3-5s
if (Common_GetIgnOnTime() >= 3000)
if (Common_GetIgnOnTime() >= 3030)
{
Key_Left_Long_Press();
}
Key_Clear_Time();
break;
case KEY_EVENT_LONG_PRESS_1: //7
break;
......@@ -48,7 +48,7 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
case KEY_EVENT_LONG_PRESS_3: //9s
break;
case KEY_EVENT_LONG_PRESS_4: //10s
if (Common_GetIgnOnTime() >= 3000)
if (Common_GetIgnOnTime() >= 3030)
{
Maintain_Reset_Service();
......@@ -86,7 +86,7 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
TYW_RESET_ODO();
}
Key_Clear_Time();
break;
case KEY_EVENT_OFF_TO_ON:
break;
......@@ -144,7 +144,7 @@ Key_Status_en_t Key_Status_Read_Left(void)
Key_Status_en_t Key_Status_Read_Right(void)
{
Key_Status_en_t enKeyReal = KEY_REALTIME_LOOSEN;
// if (SYS_OPR_STAT_IGN_ON)
// if (Common_Get_IG_Sts( ) == COMMON_POWER_ON)
// {
// if (RTE_GPIO_Get_Level(SET_P_IN))
// {
......@@ -216,7 +216,28 @@ void KEY_LEFT_EVENT_NONE_Service(void)
if((MenuInfor.Back_Time_Left > BACK_MENU_TIME) &&(PageType != Page_Menu))
{
MenuInfor.Back_Time_Left = BACK_MENU_TIME;
MenuInfor.Back_Time_Left_Flag = 1;
//MenuInfor.Back_Time_Left_Flag = 1;
if(PageType == Page_Time_Hour)
{
if (Hour_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Hour_Set = 0;
}
}
if(PageType == Page_Time_Minute)
{
if(Minute_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Minute_Set = 0;
}
}
PageType = Page_Menu ;
}
}
......@@ -224,10 +245,10 @@ void KEY_LEFT_EVENT_NONE_Service(void)
void Key_Clear_Time(void)
{
if(Key_Status_Read_Left() == KEY_REALTIME_PRESS)
//if(Key_Status_Read_Left() == KEY_REALTIME_PRESS)
{
MenuInfor.Back_Time_Left = 0;
MenuInfor.Back_Time_Left_Flag = 0;
//MenuInfor.Back_Time_Left_Flag = 0;
}
}
......@@ -330,30 +351,30 @@ void Key_Left_Short_Press(void)
void Key_Auto_Save(void)
{
if((MenuInfor.Back_Time_Left_Flag == 1))
{
if(PageType == Page_Time_Hour)
{
if (Hour_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Hour_Set = 0;
}
}
if(PageType == Page_Time_Minute)
{
if(Minute_Set == 1)
{
counter_val.time.RTC_Seconds = 0;
RTC_SetTime(&counter_val.time);
Minute_Set = 0;
}
}
PageType = Page_Menu ;
}
//if((MenuInfor.Back_Time_Left_Flag == 1))
//{
// if(PageType == Page_Time_Hour)
// {
// if (Hour_Set == 1)
// {
// counter_val.time.RTC_Seconds = 0;
// RTC_SetTime(&counter_val.time);
// Hour_Set = 0;
// }
// }
//
// if(PageType == Page_Time_Minute)
// {
// if(Minute_Set == 1)
// {
// counter_val.time.RTC_Seconds = 0;
// RTC_SetTime(&counter_val.time);
// Minute_Set = 0;
// }
//
// }
// PageType = Page_Menu ;
//}
}
......@@ -464,8 +485,9 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM
void MenuData_Unit_Init(void)
{
uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
uint8_t TCS[1] = {0};
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, TCS, 1);
MenuData.KM_Unit = 0;
//MenuData.Tpms_Unit = 0;
MenuData.Tcs_Val = TCS[0];
......@@ -473,8 +495,9 @@ void MenuData_Unit_Init(void)
}
void MenuData_TCS_Init(void)
{
uint32_t TCS[1] = {0};
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
uint8_t TCS[1] = {0};
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TCS, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, TCS, 1);
MenuData.Tcs_Val = TCS[0];
PageType = Page_Menu;
Hour_Set = 0;
......@@ -486,7 +509,7 @@ void TYW_RESET_ODO(void)
{
uint8_t Clear_EE[4] = {0xff, 0xff, 0xff, 0xff};
uint8_t Clear_EE_8[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
if(SYS_OPR_STAT_IGN_ON)
if(Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
if(ClearODO_Flag < 1)
{
......
......@@ -5,13 +5,13 @@
#include "common.h"
#include "rtc.h"
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint16_t Back_Time_Left;
uint8_t Back_Time_Left_Flag;
}_Menu_Infor;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t Set_Hour;
uint8_t Set_Minute;
......@@ -19,7 +19,7 @@ typedef struct
uint8_t Dis_Minute;
uint8_t KM_Unit; // 0 km, 1 mile
uint8_t Tpms_Unit;// 0 bar, 1 psi
uint32_t Tcs_Val; // 0 off, 1 on
uint8_t Tcs_Val; // 0 off, 1 on
uint8_t TPMS_Front_Learn;
uint8_t TPMS_Rear_Learn;
uint8_t TPMS_Front_FirstLearn_Flag;
......@@ -77,6 +77,6 @@ void Key_Check_Service(void);
void MenuData_Unit_Init(void);
void Maintain_Reset_Service(void);
void MenuData_TCS_Init(void);
void Data_TCS_Set_OnOff(uint32_t u32Data);
void Data_TCS_Set_OnOff(uint8_t u8Data);
uint8_t Get_Tpms_TX_Flag(void);
#endif
......@@ -29,7 +29,7 @@ typedef void (*LEDDriver_ShutdownPin_Set)(LED_Driver_uint8_t u8Level);
typedef void (*LEDDriver_Feed_Dog)(void);
typedef void (*LEDDriver_Delay_10us)(LED_Driver_uint16_t u16Count);
typedef struct
typedef struct __attribute__((aligned(4)))
{
/*芯片数量*/
LED_Driver_uint8_t u8LEDDriverChipNum;
......
......@@ -675,6 +675,7 @@ void LED_Driver_Init_Example(void)
/*21036芯片地址数组*/
stLEDDriverParInit.pu8AW21036ChipAddress = u8AW21036ChipAddress;
memset(u8LEDDriverRamData, 0, sizeof(u8LEDDriverRamData));
LED_Driver_Init_KL30(u8LEDDriverRamData, &stLEDDriverParInit);
/*唤醒初始化同样*/
......
#ifndef LIGHT_SENSOR_H__
#define LIGHT_SENSOR_H__
/*-------------------------------------------------------------------------------------------*/
// #define LIGHT_SENSOR_PLATFORM_16BIT
#ifdef LIGHT_SENSOR_PLATFORM_16BIT
typedef unsigned char ALS_uint8_t;
typedef unsigned int ALS_uint16_t;
typedef unsigned long ALS_uint32_t;
#else
typedef unsigned char ALS_uint8_t;
typedef unsigned short ALS_uint16_t;
typedef unsigned int ALS_uint32_t;
#endif
/*-------------------------------------------------------------------------------------------*/
#define ALS_VERSIONS 0X01U
typedef void (*ALS_Hanle)(void);
typedef void (*ALS_Hanle_Write)(ALS_uint8_t u8ALSData);
typedef ALS_uint8_t (*ALS_Hanle_Read)(void);
typedef struct
{
ALS_Hanle_Write pfnALSDelay100usCB; /*100us 延时函数*/
ALS_Hanle pfnALSIICStartCB; /*start 函数接口*/
ALS_Hanle pfnALSIICStopCB; /*stop 函数接口*/
ALS_Hanle_Write pfnALSIICTxDataCB; /*发送数据 函数接口*/
ALS_Hanle_Write pfnALSIICTxACKCB; /*发送ACK 函数接口*/
ALS_Hanle_Read pfnALSIICRxDataCB; /*接收数据 函数接口*/
ALS_Hanle_Read pfnALSIICRxACKCB; /*接收ACK 函数接口*/
} Light_Sensor_Par_st_t;
/*-------------------------------------------------------------------------------------------*/
/*
返回0:初始化成功
返回1:初始化失败
*/
extern ALS_uint8_t ALS_Init(Light_Sensor_Par_st_t *pstALSInitPar);
/*根据需要的数据更新频率进行调用*/
extern void ALS_Service(void);
extern ALS_uint16_t ALS_Get_Data0(void);
extern ALS_uint16_t ALS_Get_Data1(void);
/*-------------------------------------------------------------------------------------------*/
#endif
#include "Light_Sensor.h"
#include "Light_Sensor_Interface.h"
#include "Simulated_IIC_2_Master.h"
void ALS_Delay_100us(ALS_uint8_t u8ALSData)
{
ALS_uint32_t ALSDelayCount = 0;
ALS_uint32_t i = 0;
ALS_uint32_t j = 0;
for (j = 0; j < u8ALSData; j++)
{
for (i = 0; i < 1000; i++)
{
ALSDelayCount++;
}
}
}
/****************初始化函数调用示例*************/
void Light_Sensor_Init_Example(void)
{
Light_Sensor_Par_st_t stALSInitPar;
stALSInitPar.pfnALSDelay100usCB = ALS_Delay_100us;
stALSInitPar.pfnALSIICStartCB = Simulated_IIC_2_Start;
stALSInitPar.pfnALSIICStopCB = Simulated_IIC_2_Stop;
stALSInitPar.pfnALSIICTxDataCB = Simulated_IIC_2_Transmit_Data;
stALSInitPar.pfnALSIICTxACKCB = Simulated_IIC_2_Transmit_ACK;
stALSInitPar.pfnALSIICRxDataCB = Simulated_IIC_2_Receive_Data;
stALSInitPar.pfnALSIICRxACKCB = Simulated_IIC_2_Receive_ACK;
ALS_Init(&stALSInitPar);
}
#ifndef LIGHT_SENSOR_INTERFACE_H__
#define LIGHT_SENSOR_INTERFACE_H__
/*-----------------------------------------------------------*/
extern void Light_Sensor_Init_Example(void);
#endif
......@@ -33,7 +33,7 @@ typedef Linelib_uint16_t (*LineIn_GetPowerMode)(void);
* @brief 硬线去抖属性结构体 \n
* 定义报接收文属性
*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
Linelib_uint8_t DefaultLevel; /**< 初始电平 LEVEL_LOW /LEVEL_HIGH */
Linelib_uint8_t TriggerLevel; /**< 触发电平 LEVEL_LOW /LEVEL_HIGH */
......
......@@ -3,7 +3,7 @@
#include "Components.h"
#include "Application.h"
__attribute__((aligned(4)))
const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] =
{
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_TurnLeft, },
......@@ -140,5 +140,6 @@ static Linelib_uint16_t LINE_GET_PWR(void)
void LINE_IN_Init(void)
{
memset(LINE_IN_Men, 0, sizeof(LINE_IN_Men));
Line_In_KL30_WakeUp_Init(LINE_IN_Men, g_stLineInAttribute, LINE_IN_MAX, LINE_GET_PWR);
}
......@@ -51,10 +51,10 @@ typedef enum
EM_MILEAGE_BLOCK = 0u, /**< 累计里程 */
EM_ODO_BLOCK, /**< 总计里程 */
EM_TRIP_BLOCK, /**< 小计里程 */
EM_Maintenance_BLOCK, /**< 保养里程 */
EM_Maintenance_Firstflg, /**< 保养标志 */
EM_MenuData_Tcs_Val, /**< TCS开关标志 */
EM_MenuData_TPMS_LEARN, /**< TPMS学习结果 */
// EM_Maintenance_BLOCK, /**< 保养里程 */
// EM_Maintenance_Firstflg, /**< 保养标志 */
// EM_MenuData_Tcs_Val, /**< TCS开关标志 */
// EM_MenuData_TPMS_LEARN, /**< TPMS学习结果 */
} Data_EEPROM_Enum_t;
typedef void (*EEPromWrite)(Data_EEPROM_Enum_t BlockID, Millib_uint32_t u32Data[], Millib_uint16_t u16Len);
......
......@@ -89,21 +89,23 @@ void Data_User_Mileage_KL30Init(void)
TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBuf, 1);
if (TempBuf[0u] == 0xFFFFFFFF)
{
MenuData.Tcs_Val = 1;
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
//Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_08, &MenuData.Tcs_Val, 1);
}
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBuf, 2);
if (TempBuf[0u] == 0xFFFFFFFF)
{
TPMSLearn[0] = 0;//MenuData.TPMS_Front_Learn;
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
//TPMSLearn[2] = 0;//MenuData.TPMS_Front_FirstLearn_Flag;
//TPMSLearn[3] = 0;//MenuData.TPMS_Rear_FirstLearn_Flag;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t *)TPMSLearn, 1u);
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
//Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t *)TPMSLearn, 1u);
eeprom_WriteRecord(EEPROM_BLOCK_09, TPMSLearn, 2);
}
Milleage_InitFlag = 0X5AA53AA3UL;
......@@ -158,12 +160,12 @@ uint32_t Get_MileageInit_Status(void)
// case EM_Maintenance_Firstflg:
// eeprom_ReadRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
// case EM_MenuData_Tcs_Val:
// eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
// break;
// case EM_MenuData_TPMS_LEARN:
// eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
// break;
default:
......@@ -207,12 +209,12 @@ uint32_t Get_MileageInit_Status(void)
// case EM_Maintenance_Firstflg:
// eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
// break;
case EM_MenuData_Tcs_Val:
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
// case EM_MenuData_Tcs_Val:
// eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
// break;
// case EM_MenuData_TPMS_LEARN:
// eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
// break;
default:
break;
}
......@@ -269,7 +271,7 @@ uint32_t Get_Trip_Value(void)
}
return Trip;
}
uint32_t testtrip = 0;
/**
* @brief 当前单位在KM时,小计里程大于999.9KM,主动触发小计清零
*
......
......@@ -85,7 +85,7 @@ static void Power_KL30_Init(void)
Key_KL30_Init_EXample();
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
//LED_Driver_Service_Immediate();
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
Data_Voltage_Init();
......@@ -154,7 +154,7 @@ static void Power_Wakeup_Init(void)
MenuData_TCS_Init();
//Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
LED_Driver_Service_Immediate();
//LED_Driver_Service_Immediate();
Protocol_KL30_Wakeup_Init();
Uart0_Init(115200);
BlueTooth_KL30_KL15_Wakeup_Init();
......@@ -231,7 +231,7 @@ static void Power_Sleep_Init(void)
BU98R10_Shutdown();
Gpio_Init(Gpio_Sleep_Init);
u8LEDDriverCheckCount = 0;
LED_Driver_Service_Immediate();
//LED_Driver_Service_Immediate();
LED_Driver_Init_Sleep();
LED_Driver_Service();
Analog_Signal_Conv_Stop();
......@@ -261,7 +261,7 @@ static Power_Status_em Power_Stay_OFF(void)
Power_Status_em u8PowerSts;
u8PowerSts = EM_IGN_OFF;
if (SYS_OPR_STAT_IGN_ON)
if (Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
u8PowerSts = EM_IGN_ON_Init;
}
......
......@@ -43,7 +43,7 @@ typedef Power_Status_em (*pfunc_Power_ON)(void);
typedef Power_Status_em (*pfunc_Power_SLEEP)(void);
typedef Power_Status_em (*pfunc_Power_LIM)(void);
typedef struct
typedef struct __attribute__((aligned(4)))
{
pfunPower_KL30_Init Pwr_KL30_Init;
pfunPower_IG_OFF_Init Pwr_IG_OFF_Init;
......
......@@ -32,7 +32,7 @@ typedef Intlib_uint32_t (*Int_ReadODO)(void);
typedef void (*Int_EEPromWrite)(Intlib_uint32_t u32Data [], Intlib_uint16_t u16Len);
typedef void (*Int_EEPromRead)(Intlib_uint32_t u32Data [], Intlib_uint16_t u16Len);
typedef struct
typedef struct __attribute__((aligned(4)))
{
Int_PowerSts PowerSts_Cbk; /**< 获取系统电源状态回调 */
Int_ReadODO ReadODO_Cbk; /**< 获取当前总计里程回调 */
......@@ -40,7 +40,7 @@ typedef struct
Int_EEPromRead EEPromRead_Cbk; /**< 从EEPROM读取保养相关数据回调 */
} Maintain_Func_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
Intlib_uint32_t IntervalDayEnable; /**< 保养天数功能使能,0:无此功能 1:使能 */
Intlib_uint32_t IntervalKm; /**< 系统设定的保养里程间隔,单位km,这里特指首次保养的里程间隔,如不区分首次,则为默认值 */
......
......@@ -47,7 +47,7 @@ typedef monitorlib_uint8_t (*Get_LineInStatus)(void);
typedef void (*COMMON_Delay)(monitorlib_uint32_t mMs);
typedef void (*pfunLogic)(void);
typedef struct
typedef struct __attribute__((aligned(4)))
{
Get_Voltage_Vaild SysGet_KL30_Valid;
Get_Voltage_Vaild SysGet_KL15_Valid;
......
......@@ -47,6 +47,7 @@ Tellib_uint16_t Battery_Voltage_valid = 0;
Tellib_uint8_t LED_TCS_STATE = 0;
Tellib_uint8_t LED_TCS_CUR_STATE = 0;
Tellib_uint8_t LED_TCS_VALUE = 0;
__align(4)
const LED_Attribute_st LED_Attribute [ LED_Max ] = {
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
......@@ -226,7 +227,7 @@ 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 (Common_GetIgnOnTime() >= 3030)
{
if(Get_Fuel_Sensor_State() == FuelSensorNormal)
{
......@@ -760,9 +761,9 @@ static void LED_Navigato_Execution(Tellib_uint16_t led_status)
void Turn_Left_Right_Lamp(void)
{
if ( SYS_OPR_STAT_IGN_ON )
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
if ((Common_GetIgnOnTime() >= 3000) && (ClearODO_Flag == 0))
if ((Common_GetIgnOnTime() >= 3030) && (ClearODO_Flag == 0))
{
if (Line_In_Get_Status(LINE_IN_TurnLeft))
{
......
......@@ -163,7 +163,7 @@ void RTE_RTC_Init(RTC_Information_st_t g_stRTCInformation)
RTC->SUBCUD = 0x1D;
ISR_Register(RTC_IRQn, rtc_interrupt); //RTC????��????��??��??��
//ISR_Register(RTC_IRQn, rtc_interrupt); //RTC????��????��??��??��
RTE_RTC_Start();
......
......@@ -21,7 +21,7 @@ void Sys_2ms_Tasks(void)
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
// if (RTE_GPIO_Get_Level(VSPEED_TEN_OUT))
// {
......@@ -36,14 +36,14 @@ void Sys_2ms_Tasks(void)
void Sys_5ms_Tasks(void)
{
Flash_Sync_Signal_Generation_Service();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,5u);
}
void Sys_10ms_Tasks(void)
{
Line_In_Debounce_Service(10u);
if(Common_GetIgnOnTime() >= 3000)
if(Common_GetIgnOnTime() >= 3030)
{
Key_Service();
}
......@@ -62,8 +62,8 @@ void Sys_10ms_Tasks(void)
void Sys_20ms_Tasks(void)
{
Key_Clear_Time();
Key_Auto_Save();
//Key_Clear_Time();
//Key_Auto_Save();
Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service();
Data_Coolant_Temp_Processing_Service();
......@@ -103,7 +103,7 @@ void Sys_100ms_Tasks(void)
{
u8LEDDriverCheckCount = 0U;
LED_Driver_Work_Check();
LED_Driver_Service_Immediate();//注意顺序1
//LED_Driver_Service_Immediate();//注意顺序1
//ALS_Service();//注意顺序2
}
else
......
......@@ -61,8 +61,8 @@ int main(void)
RTE_CLOCK_Select_Start();
RTE_WDT_Enable();
Sys_Scheduler_Init();
GenDelay_Init(RTE_WDT_Clear);
Sys_Scheduler_Init();
while (1)
{
RTE_WDT_Clear();
......
/**************************************************************************//**
* \file Analog_Signals.h
* \brief Analog signal processing
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/9/10 15:16:25
* Cfg Tool Ver : 1.1.0
* Engineer :
* (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,
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.
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