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 : /* 17 : Mount driver backend class for serial drivers 18 : Mounts using custom serial protocols should be derived from this class 19 : */ 20 : #pragma once 21 : 22 : #include "AP_Mount_config.h" 23 : 24 : #if HAL_MOUNT_ENABLED 25 : 26 : #include "AP_Mount_Backend.h" 27 : 28 : class AP_Mount_Backend_Serial : public AP_Mount_Backend 29 : { 30 : public: 31 : // Constructor 32 4 : AP_Mount_Backend_Serial(class AP_Mount &frontend, class AP_Mount_Params ¶ms, uint8_t instance, uint8_t serial_instance) : 33 : AP_Mount_Backend(frontend, params, instance), 34 4 : _serial_instance(serial_instance) 35 4 : {} 36 : 37 : // perform any required initialisation for this instance 38 : void init() override; 39 : 40 : protected: 41 : 42 : // internal variables 43 : AP_HAL::UARTDriver *_uart; // uart connected to gimbal 44 : uint8_t _serial_instance; // this instance's serial instance number 45 : bool _initialised; // true if uart has been initialised 46 : }; 47 : 48 : #endif // HAL_MOUNT_ENABLED