You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
412 B
26 lines
412 B
2 years ago
|
/**
|
||
|
* TODO file description
|
||
|
*/
|
||
|
|
||
|
#include "main.h"
|
||
|
#include "app_buzzer.h"
|
||
|
#include "tim.h"
|
||
|
#include "FreeRTOS.h"
|
||
|
#include "task.h"
|
||
|
|
||
|
void app_buzzer_init()
|
||
|
{
|
||
|
/* Enable buzzer PWM */
|
||
|
HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
|
||
|
}
|
||
|
|
||
|
void app_buzzer_beep() {
|
||
|
|
||
|
// TODO make this non-blocking
|
||
|
TIM2->ARR = 25714;
|
||
|
TIM2->CCR1 = TIM2->ARR/2;
|
||
|
vTaskDelay(50);
|
||
|
TIM2->CCR1 = 0;
|
||
|
vTaskDelay(50);
|
||
|
}
|