Commit c4d9c18b authored by hu's avatar hu

调整蜂鸣器播放驱动,声音部分音源不对

parent a6bafc8a
......@@ -50,11 +50,11 @@ void Data_User_Mileage_KL30Init(void)
ODOInit.Offset = TempBuf[2];
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
Data_User_EEPROM_Read(EEPROM_BLOCK_TRIP_STAMP, TempBuf + 3, 4);
Data_User_EEPROM_Read(EEPROM_BLOCK_TRIP_STAMP, TempBuf + 3, 9);
TripInit[EM_TRIP_A].Stamp = TempBuf[3];
TripInit[EM_TRIP_A].MaxValue = 9999999u;
TripInit[EM_TRIP_A].IsRestart = 1u; /*1-循环 0-最大值保持*/
TripInit[EM_TRIP_A].IsRestart = 1u;
TripInit[EM_TRIP_B].Stamp = TempBuf[4];
TripInit[EM_TRIP_B].MaxValue = 9999999u;
......
......@@ -1122,6 +1122,7 @@ void Popups_Sound_Playing(uint8_t PopupSnd)
* Return : None
* onther : None
--------------------------------------------------------------------------*/
uint16_t Sound_test = 0;
void Popup_Alone_Sound_Server(void)
{
COMMON_PowerStatus_t u8IG_st;
......@@ -1152,6 +1153,7 @@ void Popup_Alone_Sound_Server(void)
{
if (u8IG_st == COMMON_POWER_ON)
{
/*00 忘拔钥匙*/
Sound_Delete(SND_Key_Notremoved);
......@@ -1420,6 +1422,19 @@ void Popup_Alone_Sound_Server(void)
{
Sound_Delete(SND_Fuel_Saving);
}
/*音源测试程序*/
// if(Sound_test&0x001) Sound_Request (SND_Key_Notremoved, 1); else Sound_Delete(SND_Key_Notremoved );
// if(Sound_test&0x002) Sound_Request (SND_Braking, 1); else Sound_Delete(SND_Braking );
// if(Sound_test&0x004) Sound_Request (SND_Air_Brake, 1); else Sound_Delete(SND_Air_Brake );
// if(Sound_test&0x008) Sound_Request (SND_BRAKE_LOCK, 1); else Sound_Delete(SND_BRAKE_LOCK );
// if(Sound_test&0x010) Sound_Request (SND_Parking_Brake, 1); else Sound_Delete(SND_Parking_Brake );
// if(Sound_test&0x020) Sound_Request (SND_Car_Dump_SPEED, 1); else Sound_Delete(SND_Car_Dump_SPEED );
// if(Sound_test&0x040) Sound_Request (SND_Temp_High, 1); else Sound_Delete(SND_Temp_High );
// if(Sound_test&0x080) Sound_Request (SND_Coolant_Low, 1); else Sound_Delete(SND_Coolant_Low );
// if(Sound_test&0x100) Sound_Request (SND_Oil_pressure_Low, 1); else Sound_Delete(SND_Oil_pressure_Low );
// if(Sound_test&0x200) Sound_Request (SND_ACC_AIR, 1); else Sound_Delete(SND_ACC_AIR );
// if(Sound_test&0x400) Sound_Request (SND_BackUP_SPEED, 1); else Sound_Delete(SND_BackUP_SPEED );
}
else /*IG-OFF*/
{
......
......@@ -5,26 +5,26 @@
SoundPlayCtrlStruct SoundPlayCtrl;
void Sound_Player_Init ( void )
void Sound_Player_Init(void)
{
SoundPlayCtrl.Playing = SND_SRC_NONE; //加载要播放的声音
SoundPlayCtrl.Timer = 0;
SoundPlayCtrl.Cycle = 0;
SoundPlayCtrl.Status = SND_PLAYER_IDLE;
SoundPlayCtrl.VolInit = 1;
Buzzer_Init();
Buzzer_Start_Up();
}
uint8_t Sound_Play ( uint8_t SoundID )
uint8_t Sound_Play(uint8_t SoundID)
{
if ( SoundPlayCtrl.VolInit ) //首次播放时初始化音量
if (SoundPlayCtrl.VolInit) //首次播放时初始化音量
{
SoundPlayCtrl.VolInit = 0;
}
if ( SoundID < SND_TOTAL_NUM )
if (SoundID < SND_TOTAL_NUM)
{
if ( SoundPlayCtrl.Status != SND_PLAYER_IDLE ) //如果有声音正在播放,则返回播放失败
if (SoundPlayCtrl.Status != SND_PLAYER_IDLE) //如果有声音正在播放,则返回播放失败
return 1;
SoundPlayCtrl.Playing = SoundID; //加载要播放的声音
......@@ -37,15 +37,15 @@ uint8_t Sound_Play ( uint8_t SoundID )
return 2; //返回错误状态
}
uint8_t Sound_Stop ( uint8_t SoundID )
uint8_t Sound_Stop(uint8_t SoundID)
{
if ( SoundID < SND_TOTAL_NUM )
if (SoundID < SND_TOTAL_NUM)
{
if ( ( SoundPlayCtrl.Status == SND_PLAYER_IDLE ) || \
( SoundPlayCtrl.Playing != SoundID ) ) //如果播放器已停止播放或正在播放的声音不是请求停止播放的声音
if ((SoundPlayCtrl.Status == SND_PLAYER_IDLE) ||
(SoundPlayCtrl.Playing != SoundID)) //如果播放器已停止播放或正在播放的声音不是请求停止播放的声音
return 0; //返回停止成功
if ( SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ ) //请求停止播放的声音是刚请求播放的声音
if (SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ) //请求停止播放的声音是刚请求播放的声音
{
SoundPlayCtrl.Playing = SND_SRC_NONE;
SoundPlayCtrl.Timer = 0;
......@@ -61,11 +61,11 @@ uint8_t Sound_Stop ( uint8_t SoundID )
return 2; //返回错误状态
}
void Sound_Clear ( void )
void Sound_Clear(void)
{
if ( SoundPlayCtrl.Status == SND_PLAYER_IDLE )
if (SoundPlayCtrl.Status == SND_PLAYER_IDLE)
return;
else if ( SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ )
else if (SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ)
{
SoundPlayCtrl.Playing = SND_SRC_NONE;
SoundPlayCtrl.Timer = 0;
......@@ -75,12 +75,12 @@ void Sound_Clear ( void )
}
else
{
if ( SoundPlayCtrl.Playing < SND_TOTAL_NUM )
if (SoundPlayCtrl.Playing < SND_TOTAL_NUM)
{
if ( SndAttributeTable[SoundPlayCtrl.Playing].Mode == SND_MODE_SINGLE )
Buzzer_Stop_All_Track();
if (SndAttributeTable[SoundPlayCtrl.Playing].Mode == SND_MODE_SINGLE)
Buzzer_Stop_Play();
else
Buzzer_Stop_All_Track();
;
}
SoundPlayCtrl.Playing = SND_SRC_NONE;
......@@ -90,42 +90,42 @@ void Sound_Clear ( void )
}
}
uint8_t Sound_Priority_Query ( uint8_t SoundID )
uint8_t Sound_Priority_Query(uint8_t SoundID)
{
if ( SoundID == SND_SRC_CURRENT )
if (SoundID == SND_SRC_CURRENT)
{
if ( SoundPlayCtrl.Playing < SND_TOTAL_NUM )
if (SoundPlayCtrl.Playing < SND_TOTAL_NUM)
return SndAttributeTable[SoundPlayCtrl.Playing].Priority;
else
return 0xFF;
}
else if ( SoundID < SND_TOTAL_NUM )
else if (SoundID < SND_TOTAL_NUM)
return SndAttributeTable[SoundID].Priority;
else
return 0xFF;
}
//10ms
void Sound_Play_Service ( void )
// 10ms
void Sound_Play_Service(void)
{
if ( SoundPlayCtrl.Status == SND_PLAYER_IDLE )
if (SoundPlayCtrl.Status == SND_PLAYER_IDLE)
return;
if ( SoundPlayCtrl.Timer >= 10 )
if (SoundPlayCtrl.Timer >= 10)
SoundPlayCtrl.Timer -= 10;
else if ( SoundPlayCtrl.Timer > 0 )
else if (SoundPlayCtrl.Timer > 0)
SoundPlayCtrl.Timer = 0;
if ( ( SoundPlayCtrl.Status == SND_PLAYER_PLAYING ) || ( SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ ) )
if ((SoundPlayCtrl.Status == SND_PLAYER_PLAYING) || (SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ))
{
if ( SoundPlayCtrl.Timer == 0 )
if (SoundPlayCtrl.Timer == 0)
{
if ( SoundPlayCtrl.Cycle == 0 )
if (SoundPlayCtrl.Cycle == 0)
{
if ( SoundPlayCtrl.Playing < SND_TOTAL_NUM )
if (SoundPlayCtrl.Playing < SND_TOTAL_NUM)
{
if ( SndAttributeTable[SoundPlayCtrl.Playing].Mode != SND_MODE_SINGLE )
Buzzer_Stop_All_Track();
if (SndAttributeTable[SoundPlayCtrl.Playing].Mode != SND_MODE_SINGLE)
Buzzer_Stop_Play();
}
SoundPlayCtrl.Playing = SND_SRC_NONE;
......@@ -133,20 +133,20 @@ void Sound_Play_Service ( void )
}
else
{
if ( SoundPlayCtrl.Playing < SND_TOTAL_NUM )
if (SoundPlayCtrl.Playing < SND_TOTAL_NUM)
{
if ( SndAttributeTable[SoundPlayCtrl.Playing].Mode == SND_MODE_SINGLE )
Buzzer_Play_Sound ( SndAttributeTable[SoundPlayCtrl.Playing].Index );
if (SndAttributeTable[SoundPlayCtrl.Playing].Mode == SND_MODE_SINGLE)
Buzzer_Play_Track(SndAttributeTable[SoundPlayCtrl.Playing].Index);
else
{
if ( SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ )
Buzzer_Play_Sound ( SndAttributeTable[SoundPlayCtrl.Playing].Index );
if (SoundPlayCtrl.Status == SND_PLAYER_PLAY_REQ)
Buzzer_Repeat_Play_Track(SndAttributeTable[SoundPlayCtrl.Playing].Index);
}
SoundPlayCtrl.Timer = SndAttributeTable[SoundPlayCtrl.Playing].Period;
SoundPlayCtrl.Status = SND_PLAYER_PLAYING;
if ( SoundPlayCtrl.Cycle != SND_CYCLE_NONSTOP )
if (SoundPlayCtrl.Cycle != SND_CYCLE_NONSTOP)
SoundPlayCtrl.Cycle--;
}
else
......@@ -160,18 +160,18 @@ void Sound_Play_Service ( void )
}
else //当前声音被请求停止播放
{
if ( SoundPlayCtrl.Playing < SND_TOTAL_NUM )
if (SoundPlayCtrl.Playing < SND_TOTAL_NUM)
{
if ( SndAttributeTable[SoundPlayCtrl.Playing].Mode != SND_MODE_SINGLE )
if (SndAttributeTable[SoundPlayCtrl.Playing].Mode != SND_MODE_SINGLE)
{
Buzzer_Stop_All_Track();
Buzzer_Stop_Play();
SoundPlayCtrl.Playing = SND_SRC_NONE;
SoundPlayCtrl.Cycle = 0;
SoundPlayCtrl.Status = SND_PLAYER_IDLE;
}
else
{
if ( SoundPlayCtrl.Timer == 0 )
if (SoundPlayCtrl.Timer == 0)
{
SoundPlayCtrl.Playing = SND_SRC_NONE;
SoundPlayCtrl.Cycle = 0;
......@@ -181,4 +181,3 @@ void Sound_Play_Service ( void )
}
}
}
......@@ -66,7 +66,7 @@ typedef enum
******************************************************************************/
typedef struct
{
BUZZER_Track_Index_en_t Index;
uint8_t Index;
uint8_t Priority;
uint8_t Cycle;
uint8_t Mode;
......@@ -81,32 +81,32 @@ static const SndAttributeStruct SndAttributeTable[SND_SRC_INDEX_MAX] =
/*================================================================================================
音源名称 | 音源序号 | 优先级 | 循环次数 | 播放模式 | 周期(ms)
------------------------------------------------------------------------------------------------*/
{/*00 SND_SRC_Key_Notremoved */ BUZZER_Track_Index_Tic, 1, 1, SND_MODE_SINGLE, 1000U, },/*00 1HZ 忘拔钥匙 */
{/*01 SND_SRC_Braking */ BUZZER_Track_Index_Tic, 2, 1, SND_MODE_SINGLE, 100U, },/*01 连续 制动 */
{/*02 SND_SRC_Air_Brake */ BUZZER_Track_Index_Tic, 3, 1, SND_MODE_SINGLE, 100U, },/*02 连续 制动气压 */
{/*03 SND_SRC_BRAKE_LOCK */ BUZZER_Track_Index_Tic, 4, 1, SND_MODE_SINGLE, 100U, },/*03 BRAKE LOCK */
{/*04 SND_SRC_Parking_Brake */ BUZZER_Track_Index_Tic, 5, 1, SND_MODE_SINGLE, 100U, },/*04 停车制动忘记复位*/
{/*05 SND_SRC_Car_Dump_SPEED */ BUZZER_Track_Index_Tic, 6, 1, SND_MODE_SINGLE, 100U, },/*05 车厢报警自卸蜂鸣器*/
{/*06 SND_SRC_Temp_High */ BUZZER_Track_Index_Tic, 7, 1, SND_MODE_SINGLE, 100U, },/*06 连续 水温过热 */
{/*07 SND_SRC_Coolant_Low */ BUZZER_Track_Index_Tic, 8, 1, SND_MODE_SINGLE, 100U, },/*07 连续 冷却水量 */
{/*08 SND_SRC_Oil_pressure_Low*/ BUZZER_Track_Index_Tic, 9, 1, SND_MODE_SINGLE, 100U, },/*08 -(预留:油压)*/
{/*09 SND_SRC_ACC_AIR */ BUZZER_Track_Index_Tic, 10, 1, SND_MODE_SINGLE, 100U, },/*09 连续 ACC AIR */
{/*10 SND_SRC_BackUP_SPEED */ BUZZER_Track_Index_Tic, 11, 1, SND_MODE_SINGLE, 1000U, },/*10 1HZ 倒车警报 */
{/*11 SND_SRC_DS_SPEED */ BUZZER_Track_Index_Tic, 12, 1, SND_MODE_SINGLE, 100U, },/*11 DS 警报 */
{/*12 SND_SRC_ROWS_SPEED */ BUZZER_Track_Index_Tic, 13, 1, SND_MODE_SINGLE, 100U, },/*12 ROWS 警报 */
{/*13 SND_SRC_Roll_SPEED */ BUZZER_Track_Index_Tic, 14, 1, SND_MODE_SINGLE, 100U, },/*13 Roll 警报 */
{/*14 SND_SRC_EVSC_SPEED */ BUZZER_Track_Index_Tic, 15, 1, SND_MODE_SINGLE, 100U, },/*14 4HZ EVSC */
{/*15 SND_SRC_DPD_SPEED */ BUZZER_Track_Index_Tic, 16, 1, SND_MODE_SINGLE, 100U, },/*15 1HZ 3 DPD 手动再生 */
{/*15 SND_SRC_DPD_SPEED */ BUZZER_Track_Index_Tic, 16, 1, SND_MODE_SINGLE, 100U, },/*15 2HZ 3 DPD 手动再生 */
{/*15 SND_SRC_DPD_SPEED */ BUZZER_Track_Index_Tic, 16, 1, SND_MODE_SINGLE, 100U, },/*15 4HZ 3 DPD 手动再生 */
{/*16 SND_SRC_NEES */ BUZZER_Track_Index_Tic, 17, 1, SND_MODE_SINGLE, 100U, },/*16 NEES */
{/*17 SND_SRC_ECO_STOP */ BUZZER_Track_Index_Tic, 18, 1, SND_MODE_SINGLE, 100U, },/*17 eco stop */
{/*18 SND_SRC_Cyclone_High */ BUZZER_Track_Index_Tic, 19, 1, SND_MODE_SINGLE, 100U, },/*18 4HZ 气悬车高调整 */
{/*18 SND_SRC_Cyclone_High */ BUZZER_Track_Index_Tic, 19, 1, SND_MODE_SINGLE, 100U, },/*18 0.5HZ 气悬车高调整 */
{/*19 SND_SRC_SEATBELT_SPEED */ BUZZER_Track_Index_Tic, 20, 1, SND_MODE_SINGLE, 100U, },/*19 2HZ 安全带 */
{/*20 SND_SRC_Fuel_Saving */ BUZZER_Track_Index_Tic, 21, 1, SND_MODE_SINGLE, 100U, },/*20 1HZ省油耗建议 */
{/*21 SND_SRC_TICK */ 0000u, 22, 1, SND_MODE_SINGLE, 100U, },
{/*22 SND_SRC_TOCK */ 0001u, 23, 1, SND_MODE_SINGLE, 100U, },
{/*00 SND_SRC_Key_Notremoved */ 0x01u, 1, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 1000U, },/*00 1HZ 忘拔钥匙 */
{/*01 SND_SRC_Braking */ 0x02u, 2, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*01 连续 制动 */
{/*02 SND_SRC_Air_Brake */ 0x03u, 3, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*02 连续 制动气压 */
{/*03 SND_SRC_BRAKE_LOCK */ 0x04u, 4, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*03 BRAKE LOCK */
{/*04 SND_SRC_Parking_Brake */ 0x05u, 5, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*04 停车制动忘记复位*/
{/*05 SND_SRC_Car_Dump_SPEED */ 0x06u, 6, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*05 车厢报警自卸蜂鸣器*/
{/*06 SND_SRC_Temp_High */ 0x07u, 7, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*06 连续 水温过热 */
{/*07 SND_SRC_Coolant_Low */ 0x08u, 8, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*07 连续 冷却水量 */
{/*08 SND_SRC_Oil_pressure_Low*/ 0x09u, 9, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*08 -(预留:油压)*/
{/*09 SND_SRC_ACC_AIR */ 0x0au, 10, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*09 连续 ACC AIR */
{/*10 SND_SRC_BackUP_SPEED */ 0x0bu, 11, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 1000U, },/*10 1HZ 倒车警报 */
{/*11 SND_SRC_DS_SPEED */ 0x00u, 12, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*11 DS 警报 */
{/*12 SND_SRC_ROWS_SPEED */ 0x00u, 13, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*12 ROWS 警报 */
{/*13 SND_SRC_Roll_SPEED */ 0x00u, 14, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*13 Roll 警报 */
{/*14 SND_SRC_EVSC_SPEED */ 0x00u, 15, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*14 4HZ EVSC */
{/*15 SND_SRC_DPD_SPEED */ 0x00u, 16, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*15 1HZ 3 DPD 手动再生 */
{/*15 SND_SRC_DPD_SPEED */ 0x00u, 16, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*15 2HZ 3 DPD 手动再生 */
{/*15 SND_SRC_DPD_SPEED */ 0x00u, 16, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*15 4HZ 3 DPD 手动再生 */
{/*16 SND_SRC_NEES */ 0x00u, 17, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*16 NEES */
{/*17 SND_SRC_ECO_STOP */ 0x00u, 18, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*17 eco stop */
{/*18 SND_SRC_Cyclone_High */ 0x00u, 19, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*18 4HZ 气悬车高调整 */
{/*18 SND_SRC_Cyclone_High */ 0x00u, 19, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*18 0.5HZ 气悬车高调整 */
{/*19 SND_SRC_SEATBELT_SPEED */ 0x00u, 20, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*19 2HZ 安全带 */
{/*20 SND_SRC_Fuel_Saving */ 0x00u, 21, SND_CYCLE_NONSTOP, SND_MODE_SINGLE, 100U, },/*20 1HZ省油耗建议 */
{/*21 SND_SRC_TICK */ 0x05u, 22, 1, SND_MODE_SINGLE, 100U, },
{/*22 SND_SRC_TOCK */ 0x06u, 23, 1, SND_MODE_SINGLE, 100U, },
/*==============================================================================================*/
};
......
This diff is collapsed.
......@@ -5,117 +5,40 @@
版 本:V1.0
日 期:2016.5.18
******************************************************************************/
#ifndef _BUZZER_H_
#define _BUZZER_H_
#include "GPIO.h"
#include "r_typedefs.h"
/*****************************************************************************
音轨总数
*****************************************************************************/
#define BUZZER_TRACK_CNT ((uint8_t)10)
/*****************************************************************************
声音重定义
*****************************************************************************/
#define BUZZER_SOUND_TIC ((uint8_t)0)
#define BUZZER_SOUND_TAC ((uint8_t)1)
#define BUZZER_SOUND_DONG ((uint8_t)2)
#define BUZZER_SOUND_PLING ((uint8_t)3)
#define BUZZER_SOUND_PLONG ((uint8_t)4)
#define BUZZER_SOUND_PARK_BEEP ((uint8_t)5)
#define BUZZER_SOUND_PLING_PLONG ((uint8_t)6)
/*****************************************************************************
单音重定义
*****************************************************************************/
#define BUZZER_SINGLE_SOUND_TIC ((uint8_t)0)
#define BUZZER_SINGLE_SOUND_TAC ((uint8_t)1)
#define BUZZER_SINGLE_SOUND_DONG ((uint8_t)2)
#define BUZZER_SINGLE_SOUND_PLING ((uint8_t)3)
#define BUZZER_SINGLE_SOUND_PLONG ((uint8_t)4)
#define BUZZER_SINGLE_SOUND_PARK_BEEP ((uint8_t)5)
typedef enum
{
BUZZER_Track_Index_Tic = 0x00,
BUZZER_Track_Index_Tac ,
BUZZER_Track_Index_Dong ,
BUZZER_Track_Index_Pling ,
BUZZER_Track_Index_Plong ,
BUZZER_Track_Index_ParkBeep ,
BUZZER_Track_Index_3900hz_500Dty,
BUZZER_Track_Index_2300hz_500Dty,
BUZZER_Track_Index_3900hz_280Dty,
BUZZER_Track_Index_2300hz_280Dty,
BUZZER_Track_Index_3900hz_190Dty,
BUZZER_Track_Index_2600hz_167Dty,
BUZZER_Track_Index_2000hz_500Dty,
BUZZER_Track_Index_0800hz_500Dty,
BUZZER_Track_Index_MAX,
} BUZZER_Track_Index_en_t;
/*****************************************************************************
播放类型
*****************************************************************************/
#define BUZZER_SOUND_PLAY_IDLE ((uint8_t)0)
#define BUZZER_SOUND_PLAY_REPEAT ((uint8_t)1)
#define BUZZER_SOUND_PLAY_NONSTOP ((uint8_t)2)
#define BUZZER_PWM_CHANNEL 4
/******************************************************************************
信号重定义
******************************************************************************/
#define LINE_BUZZER BUZZER_ACC_OUT_EN
//#define BUZZER_PWM_EN PWME_PWME4
//#define BUZZER_FREQ_CTRL PWMPER4 //蜂鸣器频率 = 100kHz / BUZZER_FREQ_CTRL
//#define BUZZER_DUTY_CTRL PWMDTY4
/******************************************************************************
结构定义
******************************************************************************/
typedef struct
{
uint16_t Freq; //频率控制字 设定值 = 100kHz / 单音频率
uint16_t Duty;
uint16_t PlayTime; //单音播放时间 设定值 = 单音播放时间 / 64us
uint16_t FadeOutTime; //单音淡出时间 设定值 = 单音淡出时间 / 64us
} SingleSoundStruct;
#ifndef BUZZER_CTRL
#define BUZZER_CTRL LINE_BUZZER
#endif
typedef struct
{
uint8_t SoundTable[7]; //复合音各单音列表
uint8_t SoundCnt; //复合音包含的单音总数
} ComplexSoundStruct;
#define BUZZER_MODE_IDLE 0
#define BUZZER_MODE_SINGLE 1
#define BUZZER_MODE_LOOP 2
typedef struct
{
uint8_t Mode;
uint8_t SoundID;
uint8_t RepeatNum;
uint8_t RepeatCnt;
uint8_t RepeatCycle;
uint8_t RepeatTimer;
} TrackInfoStruct;
uint8_t Track;
uint8_t Note;
uint16_t Timer;
uint16_t Fade;
} BuzzerPlayCtrlStruct;
/******************************************************************************
函数声明
******************************************************************************/
void Buzzer_Init ( void );
void Buzzer_Shutdown ( void );
void Buzzer_Play_ISR ( void ); //嵌入到64us中断中
void Warning_Sound_Init ( void );
void Buzzer_Stop_All_Track ( void );
void Buzzer_Track_Play_Service ( void ); //每20ms调用一次
void Buzzer_Track_Play ( uint8_t TrackID );
void Buzzer_Track_Stop ( uint8_t TrackID );
void Buzzer_Track_Pause ( uint8_t TrackID );
void Buzzer_Play_Sound ( uint8_t SoundID );
void Buzzer_Set_Track_Remaining_Repeat_Num ( uint8_t TrackID, uint8_t RepeatNum );
void Buzzer_Track_Init ( uint8_t TrackID, uint8_t SoundID, uint8_t RepeatNum, uint8_t RepeatCycle );
uint8_t Buzzer_Get_All_Track_Status ( void );
uint8_t Buzzer_Get_Track_Status ( uint8_t TrackID );
uint8_t Buzzer_Get_Track_Remaining_Repeat_Num ( uint8_t TrackID );
void Buzzer_Start_Up(void);
void Buzzer_Shutdown(void);
void Buzzer_Play_Track(uint8_t TrackID);
void Buzzer_Repeat_Play_Track(uint8_t TrackID);
void Buzzer_Stop_Play(void);
void Buzzer_Play_ISR(void);
#endif
......@@ -142,7 +142,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
Popup_Alone_Sound_Server();
Telltales_Left_Right_Management_Service();
Telltales_Management();
//Test_LED_AllLight();
// Test_LED_AllLight();
Key_Service();
CAN_BUSOFF_Recover();
......@@ -170,10 +170,9 @@ void Sys_Run_Mode_20ms_Tasks(void)
Voltmeter_Processing_Service();
Sound_Management_Service();
CD4051B_Debounce_Service();
Seg_Display_Service();/*段码显示逻辑*/
Seg_Display_Service(); /*段码显示逻辑*/
Seg_Buffer_Commit();
BU98R10_Update_Request();
Buzzer_Track_Play_Service();
}
/*============================================================================*/
......
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