2019-09-05 02:01:50 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
|
2022-06-27 03:39:33 -03:00
|
|
|
#ifndef AP_LTM_TELEM_ENABLED
|
|
|
|
#define AP_LTM_TELEM_ENABLED !HAL_MINIMIZE_FEATURES
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if AP_LTM_TELEM_ENABLED
|
|
|
|
|
2019-09-05 02:01:50 -03:00
|
|
|
static const uint8_t LTM_GFRAME_SIZE = 18;
|
|
|
|
static const uint8_t LTM_AFRAME_SIZE = 10;
|
|
|
|
static const uint8_t LTM_SFRAME_SIZE = 11;
|
|
|
|
|
|
|
|
class AP_LTM_Telem {
|
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
AP_LTM_Telem() {}
|
|
|
|
|
|
|
|
/* Do not allow copies */
|
|
|
|
AP_LTM_Telem(const AP_LTM_Telem &other) = delete;
|
|
|
|
AP_LTM_Telem &operator=(const AP_LTM_Telem&) = delete;
|
|
|
|
|
|
|
|
// init - perform required initialisation
|
|
|
|
void init();
|
|
|
|
|
|
|
|
private:
|
|
|
|
AP_HAL::UARTDriver *_port; // UART
|
|
|
|
|
|
|
|
uint8_t _ltm_scheduler;
|
|
|
|
uint32_t _last_frame_ms;
|
|
|
|
|
|
|
|
void send_Gframe(void);
|
|
|
|
void send_Sframe(void);
|
|
|
|
void send_Aframe(void);
|
|
|
|
void generate_LTM(void);
|
|
|
|
void send_LTM(uint8_t lt_packet[], uint8_t lt_packet_size);
|
|
|
|
void tick(void); // tick - main call to send updates to transmitter (called by scheduler at 1kHz)
|
|
|
|
};
|
2022-06-27 03:39:33 -03:00
|
|
|
|
|
|
|
#endif
|