Commit 481d2778 authored by 李冠华's avatar 李冠华

feat:修改休眠条件为仅在KL15 OFF的情况下休眠,唤醒条件为KL15 ON唤醒仪表

parent ee17ac09
...@@ -134,8 +134,9 @@ void Common_Input_Para(void) ...@@ -134,8 +134,9 @@ void Common_Input_Para(void)
Common_Set_IG_Sts(COMMON_POWER_OFF); Common_Set_IG_Sts(COMMON_POWER_OFF);
Common_Set_IG_Sts_Valid(COMMON_Valid); Common_Set_IG_Sts_Valid(COMMON_Valid);
#else #else
if (Get_CAN_Power_State() == KEY_OFF) if ((Get_CAN_Power_State() == KEY_OFF) && (RTE_GPIO_Get_Level(KL15_AD_IN) != 1U))
{ {
/*KL15 OFF的情况下开始计时*/
if (PowerIgnOffTimeLine < 0x7ffffffful) if (PowerIgnOffTimeLine < 0x7ffffffful)
{ {
PowerIgnOffTimeLine += 2u; PowerIgnOffTimeLine += 2u;
......
...@@ -84,7 +84,7 @@ extern uint32_t PowerIgnOffTimeLine; ...@@ -84,7 +84,7 @@ extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void) static void Power_Wakeup_Init(void)
{ {
PowerIgnOffTimeLine = 0; PowerIgnOffTimeLine = 0;
g_u8CanrxSleepstate = 0U; // g_u8CanrxSleepstate = 0U;
Simulated_IIC_2_Init(); Simulated_IIC_2_Init();
Gpio_Init(Gpio_WakeUp_Init); Gpio_Init(Gpio_WakeUp_Init);
Can_Init(); Can_Init();
...@@ -101,6 +101,7 @@ static void Power_Wakeup_Init(void) ...@@ -101,6 +101,7 @@ static void Power_Wakeup_Init(void)
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High); TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High); TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
Telltales_Init(); Telltales_Init();
// RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_None);
// RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_Rising); // RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_Rising);
} }
...@@ -150,8 +151,12 @@ static void Power_Sleep_Init(void) ...@@ -150,8 +151,12 @@ static void Power_Sleep_Init(void)
LED_Driver_Service(); LED_Driver_Service();
Analog_Signal_Conv_Stop(); Analog_Signal_Conv_Stop();
// RTE_DEEPSLEEP_Enable(); // RTE_DEEPSLEEP_Enable();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(CAN_MCU_RXD,Trigger_Falling); // RTE_DEEPSLEEP_GPIO_Interrupt_Enable(CAN_MCU_RXD,Trigger_Falling);
g_u8CanrxSleepstate = 0U; // if(g_powerState == 0U)
// {
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_Rising);
// }
// g_u8CanrxSleepstate = 0U;
} }
static Power_Status_em Power_Stay_ON(void) static Power_Status_em Power_Stay_ON(void)
...@@ -196,22 +201,19 @@ static Power_Status_em Power_Stay_OFF(void) ...@@ -196,22 +201,19 @@ static Power_Status_em Power_Stay_OFF(void)
{ {
u8PowerSts = EM_IGN_ON_Init; u8PowerSts = EM_IGN_ON_Init;
} }
else if (Get_CAN_Power_State() == PKEY_ON)
{
;
}
else else
{ {
if (Get_CAN_Power_State() == PKEY_ON) if ((Common_GetIgnOffTime() < 5000))
{ {
if (EnterDeepSleepCount >= 5000) u8PowerSts = EM_IGN_OFF;
{
u8PowerSts = EM_IGN_Sleep_Init;
}
else
{
u8PowerSts = EM_IGN_OFF;
}
} }
else else
{ {
if ((Common_GetIgnOffTime() < 5000)) if (RTE_GPIO_Get_Level(KL15_AD_IN))
{ {
u8PowerSts = EM_IGN_OFF; u8PowerSts = EM_IGN_OFF;
} }
...@@ -306,7 +308,7 @@ static Power_Status_em Power_Stay_Protect(void) ...@@ -306,7 +308,7 @@ static Power_Status_em Power_Stay_Protect(void)
static Power_Status_em Power_Stay_Sleep(void) static Power_Status_em Power_Stay_Sleep(void)
{ {
Power_Status_em u8PowerSts = EM_IGN_Sleep; Power_Status_em u8PowerSts = EM_IGN_Sleep;
#if (PART_NUMBER == RMR42E_60)
while (1) while (1)
{ {
RTE_WDT_Clear(); RTE_WDT_Clear();
...@@ -315,23 +317,12 @@ static Power_Status_em Power_Stay_Sleep(void) ...@@ -315,23 +317,12 @@ static Power_Status_em Power_Stay_Sleep(void)
u8PowerSts = EM_IGN_Wakeup; u8PowerSts = EM_IGN_Wakeup;
break; break;
} }
}
#else
while (1)
{
RTE_WDT_Clear();
if ((Get_CAN_Power_State() == PKEY_ON) && (g_u8CanrxSleepstate == 1U))/*当电源状态出于PKEY_ON,且接到CAN信号时,才能触发唤醒*/
{
u8PowerSts = EM_IGN_Wakeup;
g_u8CanrxSleepstate = 0U;
break;
}
else else
{ {
RTE_DEEPSLEEP_Enable(); RTE_DEEPSLEEP_Enable();
} }
} }
#endif
return u8PowerSts; return u8PowerSts;
} }
......
...@@ -178,12 +178,12 @@ void DEEPSLEEP_EXTI0_IRQHandler(void *msg) ...@@ -178,12 +178,12 @@ void DEEPSLEEP_EXTI0_IRQHandler(void *msg)
* @since 1.0.0 * @since 1.0.0
*/ */
unsigned char g_u8CanrxSleepstate = 0U; // unsigned char g_u8CanrxSleepstate = 0U;
void DEEPSLEEP_EXTI1_IRQHandler(void *msg) void DEEPSLEEP_EXTI1_IRQHandler(void *msg)
{ {
/* ����жϱ�־ */ /* ����жϱ�־ */
INTC_ClearPendingIRQ(INTP1_IRQn); INTC_ClearPendingIRQ(INTP1_IRQn);
g_u8CanrxSleepstate = 1U; // g_u8CanrxSleepstate = 1U;
} }
/** /**
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "gpio.h" #include "gpio.h"
#include "intp.h" #include "intp.h"
extern unsigned char g_u8CanrxSleepstate; // extern unsigned char g_u8CanrxSleepstate;
extern void RTE_DEEPSLEEP_GPIO_Interrupt_Enable(uint16_t u16Pin, Trigger_TypeDef EXTI_Trigger); extern void RTE_DEEPSLEEP_GPIO_Interrupt_Enable(uint16_t u16Pin, Trigger_TypeDef EXTI_Trigger);
extern void RTE_DEEPSLEEP_Enable(void); extern void RTE_DEEPSLEEP_Enable(void);
......
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