updates
[inav.git] / src / main / io / beeper.h
blobe87abdadd56b348c3e4a6cdbd69ff86e53aade9a
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight 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.
9 * Cleanflight 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.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "common/time.h"
22 typedef enum {
23 // IMPORTANT: these are in priority order, 0 = Highest
24 BEEPER_SILENCE = 0, // Silence, see beeperSilence()
26 BEEPER_RUNTIME_CALIBRATION_DONE,
27 BEEPER_HARDWARE_FAILURE, // HW failure
28 BEEPER_RX_LOST, // Beeps when TX is turned off or signal lost (repeat until TX is okay)
29 BEEPER_RX_LOST_LANDING, // Beeps SOS when armed and TX is turned off or signal lost (autolanding/autodisarm)
30 BEEPER_DISARMING, // Beep when disarming the board
31 BEEPER_ARMING, // Beep when arming the board
32 BEEPER_ARMING_GPS_FIX, // Beep a special tone when arming the board and GPS has fix
33 BEEPER_BAT_CRIT_LOW, // Longer warning beeps when battery is critically low (repeats)
34 BEEPER_BAT_LOW, // Warning beeps when battery is getting low (repeats)
35 BEEPER_GPS_STATUS, // FIXME **** Disable beeper when connected to USB ****
36 BEEPER_RX_SET, // Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled
37 BEEPER_ACTION_SUCCESS, // Action success (various actions)
38 BEEPER_ACTION_FAIL, // Action fail (varions actions)
39 BEEPER_READY_BEEP, // Ring a tone when GPS is locked and ready
40 BEEPER_MULTI_BEEPS, // Internal value used by 'beeperConfirmationBeeps()'.
41 BEEPER_DISARM_REPEAT, // Beeps sounded while stick held in disarm position
42 BEEPER_ARMED, // Warning beeps when board is armed (repeats until board is disarmed or throttle is increased)
43 BEEPER_SYSTEM_INIT, // Initialisation beeps when board is powered on
44 BEEPER_USB, // Some boards have beeper powered USB connected
45 BEEPER_LAUNCH_MODE_ENABLED, // Fixed-wing launch mode enabled
46 BEEPER_LAUNCH_MODE_LOW_THROTTLE, // Fixed-wing launch mode enabled, but throttle is low
47 BEEPER_LAUNCH_MODE_IDLE_START, // Fixed-wing launch mode enabled, motor about to start at idle after set delay
48 BEEPER_CAM_CONNECTION_OPEN, // When the 5 key simulation stated
49 BEEPER_CAM_CONNECTION_CLOSE, // When the 5 key simulation stop
51 BEEPER_ALL, // Turn ON or OFF all beeper conditions
52 BEEPER_PREFERENCE, // Save preferred beeper configuration
53 // BEEPER_ALL and BEEPER_PREFERENCE must remain at the bottom of this enum
54 } beeperMode_e;
56 void beeper(beeperMode_e mode);
57 void beeperSilence(void);
58 void beeperUpdate(timeUs_t currentTimeUs);
59 void beeperConfirmationBeeps(uint8_t beepCount);
60 uint32_t getArmingBeepTimeMicros(void);
61 beeperMode_e beeperModeForTableIndex(int idx);
62 const char *beeperNameForTableIndex(int idx);
63 int beeperTableEntryCount(void);
64 #ifdef USE_DSHOT
65 timeUs_t getDShotBeaconGuardDelayUs(void);
66 timeUs_t getLastDshotBeeperCommandTimeUs(void);
67 #endif