Skip to content

Commit

Permalink
Add a setting to disable the buzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanphilippehell committed Sep 2, 2023
1 parent efb438b commit 700d921
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@
// ########################### END OF DEBUG LCD ############################


// ############################### BUZZER ENABLE / DISABLE ###############################
#define BUZZER_ENABLED // If enabled the buzzer will buzz, otherwise not.
// ########################### END OF BUZZER ENABLE / DISABLE ############################



// ################################# VARIANT_ADC SETTINGS ############################
#ifdef VARIANT_ADC
Expand Down
4 changes: 3 additions & 1 deletion Src/bldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ void DMA1_Channel1_IRQHandler(void) {
RIGHT_TIM->BDTR |= TIM_BDTR_MOE;
}

// Create square wave for buzzer
// Create square wave for buzzer and more
buzzerTimer++;
#ifdef BUZZER_ENABLED
if (buzzerFreq != 0 && (buzzerTimer / 5000) % (buzzerPattern + 1) == 0) {
if (buzzerPrev == 0) {
buzzerPrev = 1;
Expand All @@ -146,6 +147,7 @@ void DMA1_Channel1_IRQHandler(void) {
HAL_GPIO_WritePin(BUZZER_PORT, BUZZER_PIN, GPIO_PIN_RESET);
buzzerPrev = 0;
}
#endif

// Adjust pwm_margin depending on the selected Control Type
if (rtP_Left.z_ctrlTypSel == FOC_CTRL) {
Expand Down

0 comments on commit 700d921

Please sign in to comment.