FMU: Accomodate serial only RC input

This commit is contained in:
Lorenz Meier
2016-08-12 13:55:16 +02:00
committed by Lorenz Meier
parent 1c0a494b4d
commit c3022bf713
+24 -11
View File
@@ -405,13 +405,15 @@ PX4FMU::init()
return ret; return ret;
} }
/* try to claim the generic PWM output device node as well - it's OK if we fail at this */ if (_mode != MODE_NONE) {
_class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH); /* try to claim the generic PWM output device node as well - it's OK if we fail at this */
_class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH);
if (_class_instance == CLASS_DEVICE_PRIMARY) { if (_class_instance == CLASS_DEVICE_PRIMARY) {
/* lets not be too verbose */ /* lets not be too verbose */
} else if (_class_instance < 0) { } else if (_class_instance < 0) {
warnx("FAILED registering class device"); warnx("FAILED registering class device");
}
} }
_safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY); _safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY);
@@ -422,7 +424,7 @@ PX4FMU::init()
} }
void void
PX4FMU:: safety_check_button(void) PX4FMU::safety_check_button(void)
{ {
#ifdef GPIO_BTN_SAFETY #ifdef GPIO_BTN_SAFETY
static int counter = 0; static int counter = 0;
@@ -859,10 +861,12 @@ void PX4FMU::rc_io_invert(bool invert)
{ {
INVERT_RC_INPUT(invert); INVERT_RC_INPUT(invert);
#ifdef GPIO_RC_OUT
if (!invert) { if (!invert) {
// set FMU_RC_OUTPUT high to pull RC_INPUT up // set FMU_RC_OUTPUT high to pull RC_INPUT up
px4_arch_gpiowrite(GPIO_RC_OUT, 1); px4_arch_gpiowrite(GPIO_RC_OUT, 1);
} }
#endif
} }
#endif #endif
@@ -907,8 +911,10 @@ PX4FMU::cycle()
_rcs_fd = dsm_init(RC_SERIAL_PORT); _rcs_fd = dsm_init(RC_SERIAL_PORT);
// assume SBUS input // assume SBUS input
sbus_config(_rcs_fd, false); sbus_config(_rcs_fd, false);
#ifdef GPIO_PPM_IN
// disable CPPM input by mapping it away from the timer capture input // disable CPPM input by mapping it away from the timer capture input
px4_arch_unconfiggpio(GPIO_PPM_IN); px4_arch_unconfiggpio(GPIO_PPM_IN);
#endif
#endif #endif
_initialized = true; _initialized = true;
@@ -2017,7 +2023,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
break; break;
} }
#ifdef RC_SERIAL_PORT #ifdef GPIO_SPEKTRUM_PWR_EN
case DSM_BIND_START: case DSM_BIND_START:
/* only allow DSM2, DSM-X and DSM-X with more than 7 channels */ /* only allow DSM2, DSM-X and DSM-X with more than 7 channels */
@@ -2960,6 +2966,9 @@ fmu_main(int argc, char *argv[])
if (!strcmp(verb, "mode_gpio")) { if (!strcmp(verb, "mode_gpio")) {
new_mode = PORT_FULL_GPIO; new_mode = PORT_FULL_GPIO;
} else if (!strcmp(verb, "mode_rcin")) {
exit(0);
} else if (!strcmp(verb, "mode_pwm")) { } else if (!strcmp(verb, "mode_pwm")) {
new_mode = PORT_FULL_PWM; new_mode = PORT_FULL_PWM;
@@ -3050,12 +3059,16 @@ fmu_main(int argc, char *argv[])
exit(0); exit(0);
} }
fprintf(stderr, "FMU: unrecognised command %s, try:\n", verb); fprintf(stderr, "FMU: unrecognized command %s, try:\n", verb);
#if defined(RC_SERIAL_PORT)
fprintf(stderr, " mode_rcin");
#endif
#if defined(BOARD_HAS_MULTI_PURPOSE_GPIO) #if defined(BOARD_HAS_MULTI_PURPOSE_GPIO)
fprintf(stderr, fprintf(stderr,
" mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio, test, fake, sensor_reset, id\n"); " , mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio, test, fake, sensor_reset, id\n");
#elif defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6 #elif defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6
fprintf(stderr, " mode_gpio, mode_pwm, mode_pwm4, test, sensor_reset [milliseconds], i2c <bus> <hz>\n"); fprintf(stderr, " mode_gpio, mode_pwm, mode_pwm4, test, sensor_reset [milliseconds], i2c <bus> <hz>\n");
#endif #endif
fprintf(stderr, "\n");
exit(1); exit(1);
} }