Add default frequency to loudspeaker set

This commit is contained in:
Mario Hüttel 2021-01-01 19:48:31 +01:00
parent 2c3c1c9861
commit 0e114d1344
2 changed files with 2 additions and 1 deletions

View File

@ -146,7 +146,7 @@ void loudspeaker_setup(void)
static void loudspeaker_start_beep(uint16_t val)
{
#if LOUDSPEAKER_MULTIFREQ
TIM7->ARR = val;
TIM7->ARR = (val == 1 ? LOUDSPEAKER_MULTIFREQ_DEFAULT : val);
TIM7->CNT = 0UL;
TIM7->CR1 |= TIM_CR1_CEN;
#else

View File

@ -59,6 +59,7 @@ int led_get(uint8_t num);
#define LOUDSPEAKER_RCC_MASK RCC_AHB1ENR_GPIOBEN
#define LOUDSPEAKER_PIN 1
#define LOUDSPEAKER_MULTIFREQ 1
#define LOUDSPEAKER_MULTIFREQ_DEFAULT 9
void loudspeaker_setup(void);
void loudspeaker_set(uint16_t val);