mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
update beep pwm drive
This commit is contained in:
10
Power_Pico/BSP/BEEP/beep.c
Normal file
10
Power_Pico/BSP/BEEP/beep.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "beep.h"
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
void beep_open(void) {
|
||||||
|
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_4); // 启动PWM通道4用于蜂鸣器
|
||||||
|
}
|
||||||
|
|
||||||
|
void beep_close(void) {
|
||||||
|
HAL_TIM_PWM_Stop(&htim4, TIM_CHANNEL_4); // 停止PWM通道4
|
||||||
|
}
|
||||||
18
Power_Pico/BSP/BEEP/beep.h
Normal file
18
Power_Pico/BSP/BEEP/beep.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef __BEEP_H__
|
||||||
|
#define __BEEP_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
void beep_open(void);
|
||||||
|
void beep_close(void);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user