Commit 2dad489e authored by 李冠华's avatar 李冠华

🦄 refactor:将蜂鸣器相关功能代码独立出来

parent 8d00f50a
......@@ -538,6 +538,16 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Driving_Information\Fault_Code.h</FilePath>
</File>
<File>
<FileName>Buzzer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Buzzer\Buzzer.c</FilePath>
</File>
<File>
<FileName>Buzzer.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Buzzer\Buzzer.h</FilePath>
</File>
</Files>
</Group>
<Group>
......@@ -668,11 +678,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Telltales\Telltales_Lib.h</FilePath>
</File>
<File>
<FileName>Telltales_Lib.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Telltales\Telltales_Lib.lib</FilePath>
</File>
<File>
<FileName>Telltales_user.h</FileName>
<FileType>5</FileType>
......@@ -733,6 +738,11 @@
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_20240305.lib</FilePath>
</File>
<File>
<FileName>Telltales_Lib.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Telltales\Telltales_Lib.lib</FilePath>
</File>
</Files>
</Group>
<Group>
......
......@@ -17,5 +17,6 @@
#include "Driving_Information\Data_Gear.h"
#include "BackLight\BackLight_User.h"
#include "Driving_Information\Fault_Code.h"
#include "Buzzer\Buzzer.h"
#endif
#include "Components.h"
#include "Buzzer\Buzzer.h"
uint8_t BUZZER_ON = 0;
uint16_t Buzzer_time = 0;
void Buzzer_KL30_Init(void)
{
}
void Buzzer_KL15_Init(void)
{
}
void BUZZER_Init(void)
{
Buzzer_time = 0;
BUZZER_ON = 0;
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
}
void Buzzer_Service(void)
{
if ((Get_CAN_Power_State() != PKEY_ON) && (Get_CAN_Power_State() != KEY_OFF) && (Get_CAN_Power_State() != POWER_CHECK_NULL))
{
if (g_u8TYWClearEepromFlag >= 1)
{
;
}
else
{
BUZZER_Init();
}
}
else if (Get_CAN_Power_State() == PKEY_ON)
{
if (Buzzer_time == 0)
{
;
}
if (FLASH_SYNC_05Hz)
{
if (Buzzer_time <= 6000)
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_HIGH); // OUT_EN_1
BUZZER_ON = 1;
}
else
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
BUZZER_ON = 0;
}
}
else
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
BUZZER_ON = 0;
}
if (Buzzer_time < 0xFFFF)
{
Buzzer_time++;
}
}
else
{
BUZZER_Init();
}
}
/******************************************************************************
函数名:Get_Buzzer_Status
功 能:获取显示燃油格数函数
参 数:无
返回值:Fuel.FuelSeg 显示的电量值 x1
******************************************************************************
注 意:该函数必须每 ms被调用一次
******************************************************************************/
uint8_t Get_Buzzer_Status(void)
{
return 0;
}
#ifndef BUZZER_H__
#define BUZZER_H__
#include "Application.h"
#include "Components.h"
extern uint16_t Buzzer_time;
extern uint8_t BUZZER_ON;
extern void Buzzer_KL30_Init(void);
extern void Buzzer_KL15_Init(void);
extern void Buzzer_Service(void);
extern void BUZZER_Init(void);
#endif
......@@ -3,7 +3,7 @@
#include "Application.h"
#define DISPLAY_OPEN ((Common_Get_IG_Sts() == COMMON_POWER_ON) && (Charge_OFF_Flag == 0) && (Get_CAN_Power_State() != KEY_OFF) && (Get_CAN_Power_State() != PKEY_ON) && (System_Indicator_CANFlag != 1))
uint8_t BUZZER_ON = 0;
uint8_t Charge_OFF_Flag = 0;
void TYW_Clear_Eeprom_Service(void)
......@@ -159,7 +159,6 @@ void Gauge_Service(void)
else
{
TYW_Clear_Eeprom_Service();
BUZZER_Init();
interact_PWM_Low_Duty = 100;
if (Common_GetIgnOnTime() > 1500)
{
......@@ -193,34 +192,11 @@ void Gauge_Service(void)
// Gpio_Init(Gpio_Sleep_Init);
}
interact_PWM_Low_Duty = 50;
if (FLASH_SYNC_05Hz)
{
if (Buzzer_time <= 6000)
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_HIGH); // OUT_EN_1
BUZZER_ON = 1;
}
else
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
BUZZER_ON = 0;
}
}
else
{
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
BUZZER_ON = 0;
}
if (Buzzer_time < 0xFFFF)
{
Buzzer_time++;
}
}
else
{
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(CAN_CH0_ID_CAN_0x125_Msg)) == CAN_SIG_NORMAL)
{
BUZZER_Init();
// poweroff_time = 0;
Clear_Bu98();
interact_PWM_Low_Duty = 100;
......@@ -233,7 +209,6 @@ void Gauge_Service(void)
}
else
{
BUZZER_Init();
Clear_Bu98();
interact_PWM_Low_Duty = 100;
for (i = 0; i < LampCh0_MAX; i++)
......@@ -330,12 +305,6 @@ void Checkself_LED_Display(void)
SEG_SET_Frame(1);
}
void BUZZER_Init(void)
{
Buzzer_time = 0;
BUZZER_ON = 0;
RTE_GPIO_Set_Level(RTE_GPIO_PORT04_PIN01, RTE_GPIO_LEVEL_LOW); // OUT_EN_1
}
void TYW_RESET_TIME(void)
{
......
......@@ -36,7 +36,7 @@ typedef struct
#define BATTERY_SEG_MAP_MAX (sizeof(batterySegMap)/sizeof(BatterySegMap_st_t))
#define POWERON_SCAN_TIMER 3000ul
extern uint8_t BUZZER_ON;
extern uint8_t Charge_OFF_Flag;
extern uint8_t EEPROM_Cumulativee_clean;
......@@ -54,7 +54,6 @@ void Gauge_Service(void);
void Gauge_CAN_setup_Service(void);
void Checkself_LED_Display(void);
void BUZZER_Init(void);
uint8_t Get_Clock_All_lenth(void);
uint8_t Get_CAN_Num_SBMS_Soc_2_Grid(void);
uint8_t Get_CAN_Num_MBMS_Soc_1_Grid(void);
......
......@@ -2639,7 +2639,6 @@ void Check_SEG_Display(void)
uint8_t Checkself_SEG_step = 0;
uint8_t Checkself_SEG_step_count = 0;
uint16_t Buzzer_time = 0;
void Checkself_Init(void)
{
Checkself_SEG_step = 0;
......
......@@ -125,7 +125,7 @@ extern uint8_t Checkself_SEG_step;
extern uint8_t Checkself_SEG_step_count;
extern uint8_t checkself_seg_Flag;
extern uint8_t g_u8TYWClearEepromFlag;
extern uint16_t Buzzer_time;
......
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