Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
buzzer_arch.c File Reference

Piezo buzzer tone output with a ChibiOS PWM driver. More...

#include <hal.h>
#include "modules/sound/buzzer_arch.h"
#include "mcu_periph/gpio.h"
#include <BOARD_CONFIG>
Include dependency graph for buzzer_arch.c:

Go to the source code of this file.

Macros

#define BUZZER_PWM_FREQUENCY   1000000
 PWM timer counting frequency, 1 us resolution.

Functions

void buzzer_arch_init (void)
void buzzer_arch_tone (uint16_t freq)
 Play a square wave at freq Hz, 0 for silence.

Variables

static PWMConfig buzzer_pwm_conf

Detailed Description

Piezo buzzer tone output with a ChibiOS PWM driver.

Definition in file buzzer_arch.c.

Macro Definition Documentation

◆ BUZZER_PWM_FREQUENCY

#define BUZZER_PWM_FREQUENCY   1000000

PWM timer counting frequency, 1 us resolution.

Definition at line 33 of file buzzer_arch.c.

Referenced by buzzer_arch_tone().

Function Documentation

◆ buzzer_arch_init()

void buzzer_arch_init ( void )

Definition at line 49 of file buzzer_arch.c.

References BUZZER_AF, BUZZER_GPIO, BUZZER_PIN, BUZZER_PWM_CHANNEL, buzzer_pwm_conf, BUZZER_PWMD, and gpio_setup_pin_af().

Referenced by buzzer_tunes_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buzzer_arch_tone()

void buzzer_arch_tone ( uint16_t freq)

Play a square wave at freq Hz, 0 for silence.

Definition at line 57 of file buzzer_arch.c.

References BUZZER_PWM_CHANNEL, BUZZER_PWM_FREQUENCY, and BUZZER_PWMD.

Referenced by buzzer_tunes_periodic(), start_next_note(), and tune_start().

Here is the caller graph for this function:

Variable Documentation

◆ buzzer_pwm_conf

PWMConfig buzzer_pwm_conf
static
Initial value:
= {
.frequency = BUZZER_PWM_FREQUENCY,
.period = BUZZER_PWM_FREQUENCY / 1000,
.callback = NULL,
.channels = {
{ .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
{ .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
{ .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
{ .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
},
.cr2 = 0,
.dier = 0
}
#define BUZZER_PWM_FREQUENCY
PWM timer counting frequency, 1 us resolution.
Definition buzzer_arch.c:33

Definition at line 35 of file buzzer_arch.c.

Referenced by buzzer_arch_init().