NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "system_calls.h"
21 #include "common/pt.h"
22 
23 #include "utype/cbuf.h"
24 
37 typedef enum {
38  // IMPORTANT: these are in priority order, 0 = Highest
58 
59 struct beeper_entry {
60  uint8_t mode;
61  uint8_t priority; // 0 = Highest
62  const uint8_t *sequence;
63 #ifdef BEEPER_NAMES
64  const char *name;
65 #endif
66 } ;
67 
68 struct morse_letter;
69 struct beeper {
70  int entry_pos;
71  const struct beeper_entry *cur_entry;
73 
74  struct pt state;
75  struct cbuf buffer;
76  char buffer_data[16];
77 
78  const struct morse_letter *cur_letter;
79  uint8_t part_idx;
80 
82  const struct system_calls *system;
83 };
84 
86 void beeper_init(struct beeper *self, const struct system_calls *system);
88 void beeper_write(struct beeper *self, const char *text);
90 bool beeper_start(struct beeper *self, beeper_command_t cmd);
92 void beeper_stop(struct beeper *self);
94 void beeper_update(struct beeper *self);
95 /*
96 uint32_t getArmingBeepTimeMicros(void);
97 beeperMode_e beeperModeForTableIndex(int idx);
98 const char *beeperNameForTableIndex(int idx);
99 int beeperTableEntryCount(void);
100 */
uint8_t part_idx
Definition: beeper.h:79
Definition: beeper.h:59
const struct system_calls * system
Definition: beeper.h:82
void beeper_write(struct beeper *self, const char *text)
Write any text to the beeper (will be sent as morse)
Definition: beeper.c:266
Definition: beeper.c:57
Beeps sounded while stick held in disarm position.
Definition: beeper.h:51
Silence, see beeperSilence()
Definition: beeper.h:39
ACC inflight calibration completed confirmation.
Definition: beeper.h:52
Beeps SOS when armed and TX is turned off or signal lost (autolanding/autodisarm) ...
Definition: beeper.h:41
int entry_pos
Definition: beeper.h:70
void beeper_stop(struct beeper *self)
Aborts current beeper function.
Definition: beeper.c:272
struct pt state
Definition: beeper.h:74
const struct morse_letter * cur_letter
Definition: beeper.h:78
uint8_t mode
Definition: beeper.h:60
sys_millis_t timeout
Definition: beeper.h:81
void beeper_update(struct beeper *self)
Updates beeper state.
Definition: beeper.c:334
Definition: beeper.h:69
struct system_config system
Definition: config.h:99
Longer warning beeps when battery is critically low (repeats)
Definition: beeper.h:46
int32_t sys_millis_t
Definition: system_calls.h:6
void beeper_init(struct beeper *self, const struct system_calls *system)
Initializes defaults for beeper function.
Definition: beeper.c:198
Warning beeps when board is armed (repeats until board is disarmed or throttle is increased) ...
Definition: beeper.h:55
Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled...
Definition: beeper.h:49
Beep a special tone when arming the board and GPS has fix.
Definition: beeper.h:45
Beep when arming the board.
Definition: beeper.h:44
ACC inflight calibration failed.
Definition: beeper.h:53
Beep when disarming the board.
Definition: beeper.h:43
char buffer_data[16]
Definition: beeper.h:76
Warning beeps when battery is getting low (repeats)
Definition: beeper.h:47
Beeps when TX is turned off or signal lost (repeat until TX is okay)
Definition: beeper.h:42
Beep used for indicating changed gps status (such as sattelites being aquired)
Definition: beeper.h:48
bool beeper_start(struct beeper *self, beeper_command_t cmd)
Puts beeper into a new beep state.
Definition: beeper.c:209
Ring a tone when GPS is locked and ready.
Definition: beeper.h:54
uint8_t priority
Definition: beeper.h:61
Definition: beeper.h:40
beeper_command_t
Definition: beeper.h:37
use the morse buffer to telegraph text
Definition: beeper.h:56
Definition: pt.h:99
multiple 20ms beeps
Definition: beeper.h:50
Definition: system_calls.h:200
int multibeeps
Definition: beeper.h:72
const struct beeper_entry * cur_entry
Definition: beeper.h:71
struct cbuf buffer
Definition: beeper.h:75
const uint8_t * sequence
Definition: beeper.h:62