Line data Source code
1 : /* 2 : This program is free software: you can redistribute it and/or modify 3 : it under the terms of the GNU General Public License as published by 4 : the Free Software Foundation, either version 3 of the License, or 5 : (at your option) any later version. 6 : 7 : This program is distributed in the hope that it will be useful, 8 : but WITHOUT ANY WARRANTY; without even the implied warranty of 9 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 : GNU General Public License for more details. 11 : 12 : You should have received a copy of the GNU General Public License 13 : along with this program. If not, see <http://www.gnu.org/licenses/>. 14 : */ 15 : #pragma once 16 : 17 : #include <AP_HAL/AP_HAL.h> 18 : 19 : #ifndef AP_LTM_TELEM_ENABLED 20 : #define AP_LTM_TELEM_ENABLED HAL_PROGRAM_SIZE_LIMIT_KB > 2048 21 : #endif 22 : 23 : #if AP_LTM_TELEM_ENABLED 24 : 25 : static const uint8_t LTM_GFRAME_SIZE = 18; 26 : static const uint8_t LTM_AFRAME_SIZE = 10; 27 : static const uint8_t LTM_SFRAME_SIZE = 11; 28 : 29 : class AP_LTM_Telem { 30 : public: 31 : // Constructor 32 2098 : AP_LTM_Telem() {} 33 : 34 : /* Do not allow copies */ 35 : CLASS_NO_COPY(AP_LTM_Telem); 36 : 37 : // init - perform required initialisation 38 : void init(); 39 : 40 : private: 41 : AP_HAL::UARTDriver *_port; // UART 42 : 43 : uint8_t _ltm_scheduler; 44 : uint32_t _last_frame_ms; 45 : 46 : void send_Gframe(void); 47 : void send_Sframe(void); 48 : void send_Aframe(void); 49 : void generate_LTM(void); 50 : void send_LTM(uint8_t lt_packet[], uint8_t lt_packet_size); 51 : void tick(void); // tick - main call to send updates to transmitter (called by scheduler at 1kHz) 52 : }; 53 : 54 : #endif