2019-05-01 06:13:58 -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/>.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
RC input system that uses libraries/AP_RCProtocol with UART based inputs
|
|
|
|
with either SBUS protocol or 115200 based protocols (or both)
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
#include <AP_RCProtocol/AP_RCProtocol.h>
|
|
|
|
#include "RCInput.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO || \
|
2021-01-13 17:37:52 -04:00
|
|
|
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BLUE || \
|
|
|
|
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_VNAV
|
2019-05-01 06:13:58 -03:00
|
|
|
|
|
|
|
namespace Linux {
|
|
|
|
|
|
|
|
class RCInput_RCProtocol : public RCInput {
|
|
|
|
public:
|
|
|
|
RCInput_RCProtocol(const char *dev_sbus, const char *dev_115200);
|
|
|
|
void init() override;
|
|
|
|
void _timer_tick(void) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int open_sbus(const char *path);
|
|
|
|
int open_115200(const char *path);
|
|
|
|
|
2020-01-18 20:34:07 -04:00
|
|
|
const char *dev_inverted;
|
2019-05-01 06:13:58 -03:00
|
|
|
const char *dev_115200;
|
|
|
|
|
2020-01-18 20:34:07 -04:00
|
|
|
int fd_inverted;
|
2019-05-01 06:13:58 -03:00
|
|
|
int fd_115200;
|
2020-01-18 20:34:07 -04:00
|
|
|
uint32_t last_frame_ms;
|
|
|
|
bool inverted_is_115200;
|
2019-05-01 06:13:58 -03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|