AP_BoardConfig: added BRD_SBUS_OUT parameter

when this is set to 1 it enables SBUS servo output on the SBUS
connector.
This commit is contained in:
Andrew Tridgell 2015-02-11 18:35:34 +11:00
parent 460b434708
commit e43fe520e8
2 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <drivers/drv_pwm_output.h>
#include <drivers/drv_sbus.h>
#ifdef CONFIG_ARCH_BOARD_PX4FMU_V1
#define BOARD_PWM_COUNT_DEFAULT 2
@ -68,6 +69,12 @@ const AP_Param::GroupInfo AP_BoardConfig::var_info[] PROGMEM = {
// @Description: Disabling this option will disable the use of the safety switch on PX4 for arming. Use of the safety switch is highly recommended, so you should leave this option set to 1 except in unusual circumstances.
// @Values: 0:Disabled,1:Enabled
AP_GROUPINFO("SAFETYENABLE", 3, AP_BoardConfig, _safety_enable, 1),
// @Param: SBUS_OUT
// @DisplayName: Enable use of SBUS output
// @Description: Enabling this option on a Pixhawk enables SBUS servo output from the SBUS output connector
// @Values: 0:Disabled,1:Enabled
AP_GROUPINFO("SBUS_OUT", 4, AP_BoardConfig, _sbus_out_enable, 0),
#elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
#endif
@ -103,6 +110,16 @@ void AP_BoardConfig::init()
if (_safety_enable.get() == 0) {
hal.rcout->force_safety_off();
}
if (_sbus_out_enable.get() == 1) {
fd = open("/dev/px4io", 0);
if (fd == -1 || ioctl(fd, SBUS_SET_PROTO_VERSION, 1) != 0) {
hal.console->printf("SBUS: Unable to setup SBUS output\n");
}
if (fd != -1) {
close(fd);
}
}
#elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
/* configure the VRBRAIN driver for the right number of PWMs */

View File

@ -26,6 +26,7 @@ private:
AP_Int8 _ser1_rtscts;
AP_Int8 _ser2_rtscts;
AP_Int8 _safety_enable;
AP_Int8 _sbus_out_enable;
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN