guowenxue
2019-06-26 b909103f781a5e1d66bf542441194988256ee21c
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
/*********************************************************************************
 *      Copyright:  (C) 2018 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  beep.h
 *    Description:  This file is used to control Passive buzzer or Active buzzer
 *
 *     pi@raspberrypi:~ $ gpio readall show BCM and wPi pinmap  
 *
 *                VCC ---- 5V/3.3V
 *                GND ---- GND
 *                I/O ---- GPIO.18  ---- GPIO.1 
 *                         BCM           wPi
 *                 
 *        Version:  1.0.0(2018/10/14)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2018/10/14 12:13:26"
 *                 
 ********************************************************************************/
 
#ifndef __BEEP_H
#define __BEEP_H
 
#define OFF           0
#define ON            1
 
//#define CONFIG_ACTV_BEEP
 
#define BEEP_FREQ     2400
 
/* Use Pin12 == GPIO18(BCM) == GPIO.1(wPi) */
#define PWM_PIN       1
 
int turn_passive_beep(int cmd, int freq);
 
int turn_active_beep(int cmd);
 
/*  Only passive buzzer can play tone */
#ifndef CONFIG_ACTV_BEEP 
void play_little_star(void);
#endif
 
#endif