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 : 16 : Author: Francisco Ferreira 17 : 18 : */ 19 : 20 : #pragma once 21 : 22 : #include "AP_NMEA_Output_config.h" 23 : 24 : #if HAL_NMEA_OUTPUT_ENABLED 25 : 26 : #ifndef NMEA_MAX_OUTPUTS 27 : #define NMEA_MAX_OUTPUTS 3 28 : #endif 29 : 30 : #include <AP_Param/AP_Param.h> 31 : 32 : class AP_NMEA_Output { 33 : 34 : public: 35 : 36 2098 : AP_NMEA_Output() { 37 : // setup parameter defaults 38 2098 : AP_Param::setup_object_defaults(this, var_info); 39 2098 : } 40 : 41 : /* Do not allow copies */ 42 : CLASS_NO_COPY(AP_NMEA_Output); 43 : 44 : void update(); 45 : 46 : void init(); 47 : 48 : enum class Enabled_Messages { 49 : GPGGA = (1<<0), 50 : GPRMC = (1<<1), 51 : PASHR = (1<<2), 52 : }; 53 : 54 : static const struct AP_Param::GroupInfo var_info[]; 55 : 56 : private: 57 : 58 : uint8_t _num_outputs; 59 : AP_HAL::UARTDriver* _uart[NMEA_MAX_OUTPUTS]; 60 : 61 : uint32_t _last_run_ms; 62 : 63 : AP_Int16 _interval_ms; 64 : AP_Int16 _message_enable_bitmask; 65 : }; 66 : 67 : #endif // !HAL_NMEA_OUTPUT_ENABLED