The new start

This commit is contained in:
syx_computer
2025-09-30 11:49:27 +08:00
commit 0196ca1e90
6998 changed files with 3811467 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
* Copyright (c) 2008-2023 100askTeam : Dongshan WEI <weidongshan@qq.com>
* Discourse: https://forums.100ask.net
*/
/* Copyright (C) 2008-2023 深圳百问网科技有限公司
* All rights reserved
*
*
* 免责声明: 百问网编写的文档,仅供学员学习使用,可以转发或引用(请保留作者信息),禁止用于商业用途!
* 免责声明: 百问网编写的程序,可以用于商业用途,但百问网不承担任何后果!
*
*
* 本程序遵循GPL V3协议使用请遵循协议许可
* 本程序所用的开发板: DShanMCU-F103
* 百问网嵌入式学习平台https://www.100ask.net
* 百问网技术交流社区: https://forums.100ask.net
* 百问网官方B站 https://space.bilibili.com/275908810
* 百问网官方淘宝: https://100ask.taobao.com
* 联系我们(E-mail) weidongshan@qq.com
*
* 版权所有,盗版必究。
*
* 修改历史 版本号 作者 修改内容
*-----------------------------------------------------
* 2023.08.04 v01 百问科技 创建文件
*-----------------------------------------------------
*/
#include "driver_active_buzzer.h"
#include "driver_lcd.h"
#include "driver_timer.h"
#include "stm32f1xx_hal.h"
/**********************************************************************
* 函数名称: ActiveBuzzer_Init
* 功能描述: 有源蜂鸣器的初始化函数
* 输入参数: 无
* 输出参数: 无
* 返 回 值: 无
* 修改日期: 版本号 修改人 修改内容
* -----------------------------------------------
* 2023/08/04 V1.0 韦东山 创建
***********************************************************************/
void ActiveBuzzer_Init(void)
{
/* 对于STM32F103, 有源蜂鸣器的引脚PA8配置为"output, push-pull" */
/*Configure GPIO pin : PA8 */
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
/**********************************************************************
* 函数名称: ActiveBuzzer_Control
* 功能描述: 有源蜂鸣器控制函数
* 输入参数: on - 1-响, 0-不响
* 输出参数: 无
* 返 回 值: 无
* 修改日期: 版本号 修改人 修改内容
* -----------------------------------------------
* 2023/08/04 V1.0 韦东山 创建
***********************************************************************/
void ActiveBuzzer_Control(int on)
{
if (on)
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
else
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
}
/**********************************************************************
* 函数名称: ActiveBuzzer_Test
* 功能描述: 有源蜂鸣器测试程序
* 输入参数: 无
* 输出参数: 无
* 无
* 返 回 值: 无
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
* 2023/08/04 V1.0 韦东山 创建
***********************************************************************/
void ActiveBuzzer_Test(void)
{
ActiveBuzzer_Init();
while (1)
{
LCD_PrintString(0, 0, "ActiveBuzzer ON ");
ActiveBuzzer_Control(1);
mdelay(1000);
LCD_PrintString(0, 0, "ActiveBuzzer OFF");
ActiveBuzzer_Control(0);
mdelay(1000);
}
}