-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buzzer.h
83 lines (73 loc) · 1.13 KB
/
Buzzer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* @file Buzzer.c
* @author Leo Liu
* @brief header file for buzzer
* @version 1.0
* @date 2022/07/25
*
* @copyright Copyright (c) 2022
*
*/
#ifndef __BUZZER_H
#define __BUZZER_H
#include "tim.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#define Buzzer_Func_GroundInit \
{ \
&Buzzer_Init, \
&Buzzer_Play_Song, \
}
#define MAX_VOLUME 270 //Maximum volume
#define NORMAL_VOLUME 50
typedef struct
{
enum
{
Low_Do = 1,
Low_Do_N,
Low_Re,
Low_Re_N,
Low_Mi,
Low_Fa,
Low_Fa_N,
Low_So,
Low_So_N,
Low_La,
Low_La_N,
Low_Ti,
Mid_Do,
Mid_Do_N,
Mid_Re,
Mid_Re_N,
Mid_Mi,
Mid_Fa,
Mid_Fa_N,
Mid_So,
Mid_So_N,
Mid_La,
Mid_La_N,
Mid_Ti,
High_Do,
High_Do_N,
High_Re,
High_Re_N,
High_Mi,
High_Fa,
High_Fa_N,
High_So,
High_So_N,
High_La,
High_La_N,
High_Ti,
}Note;
}Buzzer_t;
typedef struct
{
void (*Buzzer_Init)(void);
void (*Buzzer_Play_Song)(void);
}Buzzer_Func_t;
extern Buzzer_t Buzzer;
extern Buzzer_Func_t Buzzer_Func;
#endif