guowenxue
9 days ago 6c1a5eb1a9891898552bb9320ba973349ca4bffa
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
/**********************************************************************
*   Copyright: (C)2024 LingYun IoT System Studio
*      Author: GuoWenxue<guowenxue@gmail.com>
* Description: ISKBoard buzzer/beeper driver and music play
*
*   ChangeLog:
*        Version    Date       Author            Description
*        V1.0.0  2024.08.29    GuoWenxue      Release initial version
***********************************************************************/
 
#ifndef __BUZZER_H
#define __BUZZER_H
 
typedef struct
{
    uint32_t freq;      /* 音符频率,0表示休止 */
    uint32_t duration;  /* 持续时间(ms) */
} Note_t;
 
/**
 * @brief  让蜂鸣器响 $times 次,每次间隔 $interval 毫秒
 */
extern void beep_start(uint16_t times, uint16_t interval);
 
/**
 * @brief  播放歌曲
 */
extern void Play_Song(const Note_t *song, uint32_t note_count);
 
extern const Note_t twinkle[];
extern const uint32_t twinkle_count;
extern const Note_t happy_birthday[];
extern const uint32_t happy_birthday_count;
extern const Note_t jingle_bells[];
extern const uint32_t jingle_bells_count;
 
#endif