Add LTM Telemetry // Remove MSP telemetry
[betaflight.git] / src / main / telemetry / telemetry.c
blob4ac27139003862e43030ab8ae539000e9380d52d
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 #include <stdbool.h>
19 #include <stdint.h>
20 #include <stdlib.h>
22 #include "platform.h"
24 #ifdef TELEMETRY
26 #include "drivers/gpio.h"
27 #include "drivers/timer.h"
28 #include "drivers/serial.h"
29 #include "drivers/serial_softserial.h"
30 #include "io/serial.h"
32 #include "rx/rx.h"
33 #include "io/rc_controls.h"
35 #include "config/runtime_config.h"
36 #include "config/config.h"
38 #include "telemetry/telemetry.h"
39 #include "telemetry/frsky.h"
40 #include "telemetry/hott.h"
41 #include "telemetry/smartport.h"
42 #include "telemetry/ltm.h"
44 static telemetryConfig_t *telemetryConfig;
46 void telemetryUseConfig(telemetryConfig_t *telemetryConfigToUse)
48 telemetryConfig = telemetryConfigToUse;
51 void telemetryInit(void)
53 initFrSkyTelemetry(telemetryConfig);
54 initHoTTTelemetry(telemetryConfig);
55 initSmartPortTelemetry(telemetryConfig);
56 initLtmTelemetry(telemetryConfig);
58 telemetryCheckState();
61 bool telemetryDetermineEnabledState(portSharing_e portSharing)
63 bool enabled = portSharing == PORTSHARING_NOT_SHARED;
65 if (portSharing == PORTSHARING_SHARED) {
66 if (telemetryConfig->telemetry_switch)
67 enabled = IS_RC_MODE_ACTIVE(BOXTELEMETRY);
68 else
69 enabled = ARMING_FLAG(ARMED);
72 return enabled;
75 void telemetryCheckState(void)
77 checkFrSkyTelemetryState();
78 checkHoTTTelemetryState();
79 checkSmartPortTelemetryState();
80 checkLtmTelemetryState();
83 void telemetryProcess(rxConfig_t *rxConfig, uint16_t deadband3d_throttle)
85 handleFrSkyTelemetry(rxConfig, deadband3d_throttle);
86 handleHoTTTelemetry();
87 handleSmartPortTelemetry();
88 handleLtmTelemetry();
91 #endif