Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user