Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
buzzer_arch.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 Tomaso De Ponti <tomaso@aerogriduav.com>
3 *
4 * This file is part of paparazzi
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
26#include <hal.h>
28#include "mcu_periph/gpio.h"
29
30#include BOARD_CONFIG
31
33#define BUZZER_PWM_FREQUENCY 1000000
34
36 .frequency = BUZZER_PWM_FREQUENCY,
37 .period = BUZZER_PWM_FREQUENCY / 1000,
38 .callback = NULL,
39 .channels = {
40 { .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
41 { .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
42 { .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
43 { .mode = PWM_OUTPUT_DISABLED, .callback = NULL },
44 },
45 .cr2 = 0,
46 .dier = 0
47};
48
56
#define BUZZER_PWM_FREQUENCY
PWM timer counting frequency, 1 us resolution.
Definition buzzer_arch.c:33
void buzzer_arch_init(void)
Definition buzzer_arch.c:49
void buzzer_arch_tone(uint16_t freq)
Play a square wave at freq Hz, 0 for silence.
Definition buzzer_arch.c:57
static PWMConfig buzzer_pwm_conf
Definition buzzer_arch.c:35
Piezo buzzer tone output with a ChibiOS PWM driver.
void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output)
Setup a gpio for input or output with alternate function.
Definition gpio_arch.c:65
#define BUZZER_GPIO
Definition board.h:100
#define BUZZER_PWMD
Definition board.h:103
#define BUZZER_AF
Definition board.h:102
#define BUZZER_PIN
Definition board.h:101
#define BUZZER_PWM_CHANNEL
Definition board.h:104
Some architecture independent helper functions for GPIOs.
uint16_t foo
Definition main_demo5.c:58
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.