Buzzer.h 1.09 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13
/******************************************************************************
文 件 名:Buzzer.c
功能描述:蜂鸣器驱动库头文件
作    者:张暄
版    本:V1.0
日    期:2016.5.18
******************************************************************************/
#ifndef _BUZZER_H_
#define _BUZZER_H_

#include "GPIO.h"
#include "r_typedefs.h"

14
#define LINE_BUZZER BUZZER_ACC_OUT_EN
hu's avatar
hu committed
15

16 17 18
#ifndef BUZZER_CTRL
#define BUZZER_CTRL LINE_BUZZER
#endif
hu's avatar
hu committed
19

20 21 22
#define BUZZER_MODE_IDLE 0
#define BUZZER_MODE_SINGLE 1
#define BUZZER_MODE_LOOP 2
hu's avatar
hu committed
23 24 25

typedef struct
{
26 27 28 29 30 31
    uint8_t Mode;
    uint8_t Track;
    uint8_t Note;
    uint16_t Timer;
    uint16_t Fade;
} BuzzerPlayCtrlStruct;
hu's avatar
hu committed
32 33 34 35

/******************************************************************************
函数声明
******************************************************************************/
36 37 38 39 40 41
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);
hu's avatar
hu committed
42
#endif