NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sound_beeper.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #include "gpio.h"
21 
22 #if USE_BEEPER == 1
23 #define BEEP_TOGGLE digitalToggle(BEEP_GPIO, BEEP_PIN)
24 #define BEEP_OFF systemBeep(false)
25 #define BEEP_ON systemBeep(true)
26 #else
27 #define BEEP_TOGGLE do{} while(0)
28 #define BEEP_OFF do {} while(0)
29 #define BEEP_ON do {} while(0)
30 #endif
31 
32 typedef struct beeperConfig_s {
33  uint32_t gpioPeripheral;
34  uint16_t gpioPin;
37  bool isInverted;
39 
41 void beeperInit(beeperConfig_t *beeperConfig);
42 
43 void systemBeep(bool onoff);
44 
struct beeperConfig_s beeperConfig_t
Definition: config.h:81
GPIO_Mode gpioMode
Definition: sound_beeper.h:36
uint32_t gpioPeripheral
Definition: sound_beeper.h:33
bool isInverted
Definition: sound_beeper.h:37
Definition: platform.h:43
Definition: sound_beeper.h:32
GPIO_TypeDef * gpioPort
Definition: sound_beeper.h:35
void initBeeperHardware(beeperConfig_t *config)
Definition: sound_beeper_stm32f10x.c:31
void beeperInit(beeperConfig_t *beeperConfig)
Definition: sound_beeper.c:57
GPIO_Mode
Definition: platform.h:37
uint16_t gpioPin
Definition: sound_beeper.h:34
void systemBeep(bool onoff)
Definition: sound_beeper.c:52