NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
serial.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Copyright: collective.
5  * Cleanup: Martin Schröder <mkschreder.uk@gmail.com>
6  * Original source from Cleanflight.
7  *
8  * Ninjaflight is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Ninjaflight is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 // TODO: this should not depend on target just for serial_port_count
25 #include "target.h"
26 
28 typedef enum {
40 
41 typedef enum {
46 
47 typedef enum {
49  FUNCTION_MSP = (1 << 0), // 1
50  FUNCTION_GPS = (1 << 1), // 2
51  FUNCTION_TELEMETRY_FRSKY = (1 << 2), // 4
52  FUNCTION_TELEMETRY_HOTT = (1 << 3), // 8
53  FUNCTION_TELEMETRY_LTM = (1 << 4), // 16
54  FUNCTION_TELEMETRY_SMARTPORT = (1 << 5), // 32
55  FUNCTION_RX_SERIAL = (1 << 6), // 64
56  FUNCTION_BLACKBOX = (1 << 7), // 128
57  FUNCTION_TELEMETRY_MAVLINK = (1 << 8) // 256
59 
60 typedef enum {
61  BAUD_AUTO = 0,
69 } baudRate_e;
70 
73  uint16_t functionMask;
77  uint8_t telemetry_baudrateIndex; // not used for all telemetry systems, e.g. HoTT only works at 19200.
78 } __attribute__((packed)) ;
79 
80 struct serial_config {
81  uint8_t reboot_character; // which byte is used to reboot. Default 'R', could be changed carefully to something else.
83 } __attribute__((packed)) ;
84 
Definition: serial.h:62
Definition: serial.h:53
Definition: serial.h:30
uint8_t telemetry_baudrateIndex
Definition: serial.h:77
portSharing_e
Definition: serial.h:41
Definition: serial.h:67
Definition: serial.h:44
uint8_t gps_baudrateIndex
Definition: serial.h:75
uint16_t functionMask
Definition: serial.h:73
#define SERIAL_PORT_COUNT
Definition: target.h:92
Definition: serial.h:71
Definition: serial.h:32
serialPortIdentifier_e
serial port identifiers
Definition: serial.h:28
Definition: serial.h:61
uint8_t msp_baudrateIndex
Definition: serial.h:74
Definition: serial.h:31
Definition: serial.h:35
Definition: serial.h:68
Definition: serial.h:33
Definition: serial.h:66
Definition: serial.h:55
Definition: serial.h:49
serialPortFunction_e
Definition: serial.h:47
Definition: serial.h:54
serialPortIdentifier_e identifier
Definition: serial.h:72
Definition: serial.h:29
baudRate_e
Definition: serial.h:60
Definition: serial.h:80
Definition: serial.h:50
Definition: serial.h:37
Definition: serial.h:43
struct serial_port_config portConfigs[SERIAL_PORT_COUNT]
Definition: serial.h:82
Definition: serial.h:48
Definition: serial.h:51
Definition: serial.h:36
Definition: serial.h:63
uint8_t reboot_character
Definition: serial.h:81
Definition: serial.h:64
Definition: serial.h:42
Definition: serial.h:52
Definition: serial.h:57
uint8_t blackbox_baudrateIndex
Definition: serial.h:76
Definition: serial.h:38
typedef __attribute__
Definition: serial.h:65
Definition: serial.h:34
Definition: serial.h:56