Signed-off-by: kevin <kevin@lmve.net>

This commit is contained in:
2022-04-02 18:13:21 +08:00
parent e95a273ea5
commit f6b46cb51c
18 changed files with 37 additions and 3 deletions
+16
View File
@@ -0,0 +1,16 @@
/*
* buzzer.c
*
* Created on: 2022年4月2日
* Author: wuwen
*/
#include "buzzer.h"
void play_ones(uint16_t freq,uint8_t dutya)
{
//寄存器写法 需要根据单片机的时钟来写。
TIM14->ARR = (uint32_t)((48000000/freq)-1);TIM14->CCR1 = (uint32_t)(((48000000/freq)-1)*((float)dutya/100));
}