eecs-bsp-test-code-2/inc/Beep.h

28 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**********************************Beep V2.0 说明 ************************************************************************
Beep用于控制“STC-B学习板”上无源蜂鸣器的发声。Beep模块共提供1个驱动函数、2个应用函数
(1) BeepInit():蜂鸣器模块驱动函数
(2) Set_Beep(unsigned int Beep_freq, unsigned char Beep_time):控制蜂鸣器发声,非阻塞型
函数参数:
Beep_freq指定发声频率单位Hz。小于10将无输出
Beep_time指定发声时长。发声时长10*Beep_time (mS) ,最长 655350mS
函数返回值enumSetBeepOK调用成功enumSetBeepFail调用失败或因蜂鸣器正在发音
(3) GetBeepStatus(void): 获取Beep当前状态,enmuBeepFree:空闲, enumBeepBusy ,正在发音
(4) Beep模块使用了STC内部CCP模块1通道
编写徐成电话18008400450 2021年3月3日设计2021年3月26日更新
*/
#ifndef _beep_H_
#define _beep_H_
extern void BeepInit(); // 蜂鸣器初始化
extern char SetBeep(unsigned int Beep_freq, unsigned int Beep_time); // 发指定频率声音, 发声时长10×Beep_time (mS) ,最长 655350mS
// Beep_freq < 10 Hz, 不发音
// 函数返回 enumSetBeepOK调用成功 enumSetBeepFail调用失败调用时正在发音
extern unsigned char GetBeepStatus(void); // 获取状态,enumBeepFree:自由, enumBeepBusy,正在发声
enum BeepActName {enumBeepFree=0,enumBeepBusy,enumSetBeepOK,enumSetBeepFail};
#endif