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 ebe9e0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions Src/bldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void DMA1_Channel1_IRQHandler(void) {
RIGHT_TIM->BDTR |= TIM_BDTR_MOE;
}

#ifdef BUZZER_ENABLED
// Create square wave for buzzer
buzzerTimer++;
if (buzzerFreq != 0 && (buzzerTimer / 5000) % (buzzerPattern + 1) == 0) {
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 ebe9e0e

Please sign in to comment.