Buzzer.h 1.12 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 BUZZER_PWM_CHANNEL 4
hu's avatar
hu committed
15

16
#define LINE_BUZZER BUZZER_ACC_OUT_EN
hu's avatar
hu committed
17

18 19 20
#ifndef BUZZER_CTRL
#define BUZZER_CTRL LINE_BUZZER
#endif
hu's avatar
hu committed
21

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

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

/******************************************************************************
函数声明
******************************************************************************/
38 39 40 41 42 43
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
44
#endif