Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Frsky_Telem/AP_Frsky_Telem.h
Views: 1798
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/14#pragma once1516#include "AP_Frsky_config.h"1718#if AP_FRSKY_TELEM_ENABLED1920#include "AP_Frsky_Backend.h"21#include "AP_Frsky_SPort.h"2223class AP_Frsky_Parameters;2425class AP_Frsky_Telem {2627public:28AP_Frsky_Telem();2930~AP_Frsky_Telem();3132/* Do not allow copies */33CLASS_NO_COPY(AP_Frsky_Telem);3435// init - perform required initialisation36bool init(bool use_external_data=false);3738static AP_Frsky_Telem *get_singleton(void) {39return singleton;40}4142// get next telemetry data for external consumers of SPort data43static bool get_telem_data(AP_Frsky_Backend::sport_packet_t* packet_array, uint8_t &packet_count, const uint8_t max_size);44#if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL45// set telemetry data from external producer of SPort data46static bool set_telem_data(const uint8_t frame,const uint16_t appid, const uint32_t data);47#endif4849void queue_message(MAV_SEVERITY severity, const char *text) {50if (_backend == nullptr) {51return;52}53return _backend->queue_text_message(severity, text);54}5556private:5758AP_Frsky_Backend *_backend;59AP_Frsky_Parameters* _frsky_parameters;6061// get next telemetry data for external consumers of SPort data (internal function)62bool _get_telem_data(AP_Frsky_Backend::sport_packet_t* packet_array, uint8_t &packet_count, const uint8_t max_size);63#if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL64// set telemetry data from external producer of SPort data (internal function)65bool _set_telem_data(const uint8_t frame, const uint16_t appid, const uint32_t data);66#endif67static void try_create_singleton_for_external_data(void);68static AP_Frsky_Telem *singleton;6970};7172namespace AP {73AP_Frsky_Telem *frsky_telem();74};7576#endif // AP_FRSKY_TELEM_ENABLED777879