Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
haoJin750TFT
Commits
ad844758
Commit
ad844758
authored
Jul 09, 2024
by
时昊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:修改电源管理模式,增加唤醒引脚,增加时钟初始化,
parent
b8266562
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
81 deletions
+80
-81
Components.h
Firmware/Source/Component/Components.h
+1
-0
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+79
-81
No files found.
Firmware/Source/Component/Components.h
View file @
ad844758
...
...
@@ -27,5 +27,6 @@
#include "Data_ESpeed.h"
#include "Data_VSpeed.h"
#include "BackLight.h"
#include "RTC\RTE_RTC.h"
#endif
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
ad844758
#include "PowerManagement.h"
#include "Components.h"
//
RTC_Information_st_t g_stRTCInformation;
RTC_Information_st_t
g_stRTCInformation
;
static
void
Power_KL30_Init
(
void
);
static
void
Power_Wakeup_Init
(
void
);
...
...
@@ -10,14 +10,11 @@ static void Power_OVP_Init(void);
static
void
Power_IG_OFF_Init
(
void
);
static
void
Power_IG_ON_Init
(
void
);
static
void
Power_Sleep_Init
(
void
);
static
Power_Status_em
Power_Stay_ON
(
void
);
static
Power_Status_em
Power_Stay_OFF
(
void
);
static
Power_Status_em
Power_Stay_Protect
(
void
);
static
Power_Status_em
Power_Stay_Sleep
(
void
);
static
const
st_PowerGroup
g_stPwrTasks
=
{
Power_KL30_Init
,
Power_IG_OFF_Init
,
...
...
@@ -56,20 +53,19 @@ static void Power_KL30_Init(void)
Data_User_Mileage_KL30Init
();
Fuel_KL30_Init
();
Amt630hInit
();
//Telltales_Init();
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER1
,
400
,
64000000
);
TimerM_PWM_CH_Output_init
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
ActiveLevel_High
);
// g_stRTCInformation.u8RTCSecond = 0;
// g_stRTCInformation.u8RTCMinute = 0;
// g_stRTCInformation.u8RTCHour = 0;
// g_stRTCInformation.u8RTCDayOfMonth = 1;
// g_stRTCInformation.u8RTCMonth = 1;
// g_stRTCInformation.u8RTCYear = 20;
// RTE_RTC_Init(g_stRTCInformation);
// RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
g_stRTCInformation
.
u8RTCSecond
=
0
;
g_stRTCInformation
.
u8RTCMinute
=
0
;
g_stRTCInformation
.
u8RTCHour
=
0
;
g_stRTCInformation
.
u8RTCDayOfMonth
=
1
;
g_stRTCInformation
.
u8RTCMonth
=
1
;
g_stRTCInformation
.
u8RTCYear
=
20
;
RTE_RTC_Init
(
g_stRTCInformation
);
Menu_User_Init
();
Protocol_KL30_Wakeup_Init
();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
}
//extern uint32_t PowerIgnOffTimeLine;
static
void
Power_Wakeup_Init
(
void
)
...
...
@@ -77,26 +73,24 @@ static void Power_Wakeup_Init(void)
// PowerIgnOffTimeLine = 0;
Gpio_Init
(
Gpio_WakeUp_Init
);
eeprom_StoreInfo_Init
();
Analog_Signal_Conv_Init
();
Data_User_Mileage_WakeupInit
();
Sys_WakeUp_Init
();
Data_Vehicle_Speed_KL30_Wakeup_Init
();
Data_Engine_Speed_KL30_Wakeup_Init
();
LINE_IN_Init
();
Key_Wakeup_Init_EXample
();
Line_In_KL15_ON_Init
();
Fuel_KL30_Init
();
Amt630hInit
();
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER1
,
400
,
64000000
);
TimerM_PWM_CH_Output_init
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
ActiveLevel_High
);
//Telltales_Init();
// RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
Sys_WakeUp_Init
();
Data_Vehicle_Speed_KL30_Wakeup_Init
();
Data_Engine_Speed_KL30_Wakeup_Init
();
LINE_IN_Init
();
Key_Wakeup_Init_EXample
();
Line_In_KL15_ON_Init
();
Fuel_KL30_Init
();
Amt630hInit
();
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER1
,
400
,
64000000
);
TimerM_PWM_CH_Output_init
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
ActiveLevel_High
);
//Telltales_Init();
Key_KL30_Init_EXample
();
Menu_User_WAKEUP
();
Protocol_KL30_Wakeup_Init
();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
}
static
void
Power_LVP_Init
(
void
)
...
...
@@ -111,7 +105,6 @@ static void Power_OVP_Init(void)
static
void
Power_IG_OFF_Init
(
void
)
{
Line_In_KL15_OFF_Init
();
}
static
void
Power_IG_ON_Init
(
void
)
...
...
@@ -125,19 +118,15 @@ static void Power_IG_ON_Init(void)
static
void
Power_Sleep_Init
(
void
)
{
TimerM_PWM_counter_Output_Init
(
TIMERM_COUNTER1
,
400
,
0
);
// //RTC_Stop();
// rte_can_deinit(CAN_CH_0);
rte_can_deinit
(
CAN_CH_0
);
TMM0_Stop
();
TMM1_Stop
();
TMM_All_Stop
();
RTE_ADC_DeInit
();
// //CGC->CSC = 1 ; //HIOSTOP = 1
RTE_ADC_DeInit
();
Gpio_Init
(
Gpio_Sleep_Init
);
AMT630H_Sleep
();
Analog_Signal_Conv_Stop
();
// RTE_DEEPSLEEP_Enable();
Analog_Signal_Conv_Stop
();
RTE_DEEPSLEEP_Enable
();
}
static
Power_Status_em
Power_Stay_ON
(
void
)
...
...
@@ -162,66 +151,75 @@ static Power_Status_em Power_Stay_OFF(void)
Power_Status_em
u8PowerSts
;
u8PowerSts
=
EM_IGN_OFF
;
if
(
SYS_OPR_STAT_IGN_ON
)
{
u8PowerSts
=
EM_IGN_ON_Init
;
}
else
{
if
((
Common_GetIgnOffTime
()
<
20000
))
{
u8PowerSts
=
EM_IGN_OFF
;
}
else
{
u8PowerSts
=
EM_IGN_Sleep_Init
;
}
}
if
(
SYS_OPR_STAT_IGN_ON
)
{
u8PowerSts
=
EM_IGN_ON_Init
;
}
else
{
if
((
Common_GetIgnOffTime
()
<
1000
))
{
u8PowerSts
=
EM_IGN_OFF
;
}
else
{
//igoff大于1s且下15电才进休眠,否则一直保持在igoff状态
if
(
Sys_Read_KL15_Voltage
()
<
5000
)
{
u8PowerSts
=
EM_IGN_Sleep_Init
;
}
}
}
return
u8PowerSts
;
}
static
Power_Status_em
Power_Stay_Protect
(
void
)
{
Power_Status_em
u8PowerSts
;
Power_Status_em
u8PowerSts
;
// static uint8_t i;
static
uint8_t
Delaycnt
;
static
uint8_t
Delaycnt
;
/* 关闭所有外设,坪保留AD采集,电溝状思切�? */
{
/* 关闭所有外设,坪保留AD采集,电溝状思切�? */
{
TimerM_PWM_set_duty
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
0
);
}
u8PowerSts
=
EM_IGN_OFF_Init
;
/* 电溝模弝正常 */
for
(
;;
)
{
RTE_WDT_Clear
();
Gen_TimeDelay
(
2000u
,
50u
);
Analog_Signal_Conv_Service
();
Sys_Status_Update_Service
();
if
(
SYS_OPR_STAT_RUN
)
{
return
u8PowerSts
;
}
}
}
u8PowerSts
=
EM_IGN_OFF_Init
;
/* 电溝模弝正常 */
for
(
;;
)
{
RTE_WDT_Clear
();
Gen_TimeDelay
(
2000u
,
50u
);
Analog_Signal_Conv_Service
();
Sys_Status_Update_Service
();
if
(
SYS_OPR_STAT_RUN
)
{
return
u8PowerSts
;
}
//进入异常电压,电源库里直接将15电等于0,则直接退出,状态是igoff,下15则进入休眠
if
(
SYS_OPR_STAT_IGN_OFF
)
{
break
;
}
}
}
static
Power_Status_em
Power_Stay_Sleep
(
void
)
{
Power_Status_em
u8PowerSts
=
EM_IGN_Sleep
;
while
(
1
)
{
RTE_WDT_Clear
();
if
(
RTE_GPIO_Get_Level
(
KL15_AD_IN
))
/* KL15 */
{
u8PowerSts
=
EM_IGN_Wakeup
;
break
;
}
}
while
(
1
)
{
RTE_WDT_Clear
();
if
(
RTE_GPIO_Get_Level
(
KL15_AD_IN
))
/* KL15 */
{
u8PowerSts
=
EM_IGN_Wakeup
;
break
;
}
}
return
u8PowerSts
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment