[SITL] Enable telemetry: LTM and MAVLink (#8940)
[inav.git] / src / main / telemetry / ltm.h
blob68fdeec0026624532689d60cddcc8b0ef755111a
1 /*
2 * ltm.h
4 * This file is part of Cleanflight.
6 * Cleanflight 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 3 of the License, or
9 * (at your option) any later version.
11 * Cleanflight 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.
16 * You should have received a copy of the GNU General Public License
17 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
20 #pragma once
22 typedef enum {
23 LTM_FRAME_START = 0,
24 LTM_AFRAME = LTM_FRAME_START, // Attitude Frame
25 LTM_SFRAME, // Status Frame
26 #if defined(USE_GPS)
27 LTM_GFRAME, // GPS Frame
28 LTM_OFRAME, // Origin Frame
29 LTM_XFRAME, // Extended information data frame
30 #endif
31 LTM_NFRAME, // Navigation Frame (inav extension)
32 LTM_FRAME_COUNT
33 } ltm_frame_e;
35 // payload size does not include the '$T' header, the frame type byte or the checksum byte
36 #define LTM_GFRAME_PAYLOAD_SIZE 14
37 #define LTM_AFRAME_PAYLOAD_SIZE 6
38 #define LTM_SFRAME_PAYLOAD_SIZE 7
39 #define LTM_OFRAME_PAYLOAD_SIZE 14
40 #define LTM_NFRAME_PAYLOAD_SIZE 6
41 #define LTM_XFRAME_PAYLOAD_SIZE 6
43 #define LTM_MAX_PAYLOAD_SIZE 14
44 #define LTM_MAX_MESSAGE_SIZE (LTM_MAX_PAYLOAD_SIZE+4)
47 typedef enum {
48 LTM_MODE_MANUAL = 0,
49 LTM_MODE_RATE,
50 LTM_MODE_ANGLE,
51 LTM_MODE_HORIZON,
52 LTM_MODE_ACRO,
53 LTM_MODE_STABALIZED1,
54 LTM_MODE_STABALIZED2,
55 LTM_MODE_STABILIZED3,
56 LTM_MODE_ALTHOLD,
57 LTM_MODE_GPSHOLD,
58 LTM_MODE_WAYPOINTS,
59 LTM_MODE_HEADHOLD,
60 LTM_MODE_CIRCLE,
61 LTM_MODE_RTH,
62 LTM_MODE_FOLLOWWME,
63 LTM_MODE_LAND,
64 LTM_MODE_FLYBYWIRE1,
65 LTM_MODE_FLYBYWIRE2,
66 LTM_MODE_CRUISE,
67 LTM_MODE_UNKNOWN,
68 // INAV specific extensions
69 LTM_MODE_LAUNCH,
70 LTM_MODE_AUTOTUNE
71 } ltm_modes_e;
73 void initLtmTelemetry(void);
74 void handleLtmTelemetry(void);
75 void checkLtmTelemetryState(void);
77 void freeLtmTelemetryPort(void);
78 void configureLtmTelemetryPort(void);
80 int getLtmFrame(uint8_t *frame, ltm_frame_e ltmFrameType);