STM32H750XB_RT-THREAD/33-TIM—电容按键/User/beep/bsp_beep.c
2025-07-21 14:34:29 +08:00

51 lines
1.4 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
******************************************************************************
* @file bsp_led.c
* @author fire
* @version V1.0
* @date 2016-xx-xx
* @brief 蜂鸣器函数接口
******************************************************************************
* @attention
*
* 实验平台:野火 STM32 H750 开发板
* 论坛 :http://www.firebbs.cn
* 淘宝 :http://firestm32.taobao.com
*
******************************************************************************
*/
#include "./beep/bsp_beep.h"
/**
* @brief 初始化控制蜂鸣器的IO
* @param 无
* @retval 无
*/
void BEEP_GPIO_Config(void)
{
/*定义一个GPIO_InitTypeDef类型的结构体*/
GPIO_InitTypeDef GPIO_InitStructure;
/*开启控制蜂鸣器的GPIO的端口时钟*/
BEEP_GPIO_CLK_ENABLE();
/*选择要控制蜂鸣器的GPIO*/
GPIO_InitStructure.Pin = BEEP_GPIO_PIN;
/*设置GPIO模式为通用推挽输出*/
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStructure.Pull = GPIO_PULLDOWN;
/*设置GPIO速率为50MHz */
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;
/*调用库函数初始化控制蜂鸣器的GPIO*/
HAL_GPIO_Init(BEEP_GPIO_PORT, &GPIO_InitStructure);
/* 关闭蜂鸣器*/
HAL_GPIO_WritePin(BEEP_GPIO_PORT, BEEP_GPIO_PIN,GPIO_PIN_RESET);
}
/*********************************************END OF FILE**********************/