set FMU_RC_OUTPUT high for all non-SBUS modes

This commit is contained in:
Mark Whitehorn
2016-01-14 17:55:54 +01:00
committed by Lorenz Meier
parent 5cf78cd450
commit 47207b8fc8
2 changed files with 18 additions and 5 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ __BEGIN_DECLS
#define SPEKTRUM_RX_AS_UART() stm32_configgpio(GPIO_USART1_RX)
// FMUv4 has a separate GPIO for serial RC output
#define GPIO_RC_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN6)
#define GPIO_RC_OUT (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN6)
#define SPEKTRUM_RX_AS_GPIO() stm32_configgpio(GPIO_RC_OUT)
#define SPEKTRUM_RX_HIGH(_s) stm32_gpiowrite(GPIO_RC_OUT, (_s))
+17 -4
View File
@@ -227,6 +227,8 @@ private:
unsigned frame_drops, int rssi);
void dsm_bind_ioctl(int dsmMode);
void set_rc_scan_state(RC_SCAN _rc_scan_state);
void rc_io_invert();
void rc_io_invert(bool invert);
};
const PX4FMU::GPIOConfig PX4FMU::_gpio_tab[] = {
@@ -678,6 +680,16 @@ void PX4FMU::set_rc_scan_state(RC_SCAN newState)
_rc_scan_state = newState;
}
void PX4FMU::rc_io_invert(bool invert)
{
INVERT_RC_INPUT(invert);
if (!invert) {
// set FMU_RC_OUTPUT high to pull RC_INPUT up
stm32_gpiowrite(GPIO_RC_OUT, 1);
}
}
void
PX4FMU::cycle()
{
@@ -914,7 +926,7 @@ PX4FMU::cycle()
_rc_scan_begin = now;
// Configure serial port for SBUS
sbus_config(_rcs_fd, false);
INVERT_RC_INPUT(true);
rc_io_invert(true);
} else if (now - _rc_scan_last_lock < rc_scan_max
|| now - _rc_scan_begin < rc_scan_max) {
@@ -945,7 +957,7 @@ PX4FMU::cycle()
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
INVERT_RC_INPUT(false);
rc_io_invert(false);
} else if (now - _rc_scan_last_lock < rc_scan_max
|| now - _rc_scan_begin < rc_scan_max) {
@@ -976,7 +988,7 @@ PX4FMU::cycle()
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
INVERT_RC_INPUT(false);
rc_io_invert(false);
} else if (now - _rc_scan_last_lock < rc_scan_max
|| now - _rc_scan_begin < rc_scan_max) {
@@ -1015,7 +1027,7 @@ PX4FMU::cycle()
_rc_scan_begin = now;
// // Configure serial port for DSM
dsm_config(_rcs_fd);
INVERT_RC_INPUT(false);
rc_io_invert(false);
} else if (now - _rc_scan_last_lock < rc_scan_max
|| now - _rc_scan_begin < rc_scan_max) {
@@ -1057,6 +1069,7 @@ PX4FMU::cycle()
_rc_scan_begin = now;
// Configure timer input pin for CPPM
stm32_configgpio(GPIO_PPM_IN);
rc_io_invert(false);
} else if (now - _rc_scan_last_lock < rc_scan_max
|| now - _rc_scan_begin < rc_scan_max) {