/*********************************************************************************
|
* Copyright: (C) 2021 LingYun IoT System Studio
|
* All rights reserved.
|
*
|
* Filename: pwm.h
|
* Description: This file is used to control PWM buzzer/Led
|
*
|
* Pin connection:
|
* PWM Module Raspberry Pi Board
|
* VCC <-----> 5V
|
* buzzer <-----> #Pin32(BCM GPIO12)
|
* Led <-----> #Pin33(BCM GPIO13)
|
* GND <-----> GND
|
*
|
* /boot/config.txt:
|
*
|
* dtoverlay=pwm,pin=12,func=4 (Buzzer)
|
* dtoverlay=pwm,pin=13,func=4 (Led)
|
*
|
********************************************************************************/
|
|
|
#ifndef _PWM_H_
|
#define _PWM_H_
|
|
#define PWMCHIP_PATH "/sys/class/pwm/pwmchip0"
|
|
#define ENABLE 1
|
#define DISABLE 0
|
|
#define CHN_BEEPER 0
|
#define FRQ_BEEPER 2700
|
|
#define CHN_RGBLED 1
|
#define FRQ_RGBLED 100
|
|
extern int init_pwm(int channel, int freq, int duty);
|
extern int turn_pwm(int channel, int status);
|
extern int term_pwm(int channel);
|
|
extern int turn_beep(int times);
|
|
#endif /* ----- #ifndef _PWM_H_ ----- */
|