mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
[Sponsored by Holybro] Support for Kakute H743-Wing (#24669)
* hrt: Fix PPM input on channel 2 The CCMR1_PPM define for PPM input on channel 2 was incorrectly set to 2, which was setting bits for channel 1 instead of channel 2. This prevented PPM input from functioning properly on channel 2. Changed CCMR1_PPM for channel 2 from 2 to (1 << 8), which correctly configures the CC2S bits for input capture mode on TI2. This fixes an issue noted in the existing code comment: "FIXME! There is an interaction in the CCMR registers that prevents using Chan 1 as the timer and chan 2 as the PPM" Tested on STM32H743 with PPM input on PC7 (TIM8_CH2). * rc_input: enable sharing serial and PPM pin By setting RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX it is now possible to use the same pin on the STM32 for PPM input as well as serial input. * boards: Add support for Holybro KakuteH7-Wing
This commit is contained in:
@@ -108,6 +108,18 @@ RCInput::init()
|
||||
#ifdef GPIO_PPM_IN
|
||||
// disable CPPM input by mapping it away from the timer capture input
|
||||
px4_arch_unconfiggpio(GPIO_PPM_IN);
|
||||
|
||||
#ifdef RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
// If we use the same STM32 pin for PPM input as well as serial input, we
|
||||
// need to configure the serial port, as long as we're actually using that
|
||||
// serial device.
|
||||
if (strcmp(_device, RC_SERIAL_PORT) == 0) {
|
||||
px4_arch_configgpio(RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX);
|
||||
}
|
||||
|
||||
#endif // RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
#endif // GPIO_PPM_IN
|
||||
|
||||
rc_io_invert(false);
|
||||
@@ -661,6 +673,15 @@ void RCInput::Run()
|
||||
#ifdef HRT_PPM_CHANNEL
|
||||
if (_rc_scan_begin == 0) {
|
||||
_rc_scan_begin = cycle_timestamp;
|
||||
|
||||
#ifdef RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
if (strcmp(_device, RC_SERIAL_PORT) == 0) {
|
||||
px4_arch_unconfiggpio(RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX);
|
||||
}
|
||||
|
||||
#endif // RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
// Configure timer input pin for CPPM
|
||||
px4_arch_configgpio(GPIO_PPM_IN);
|
||||
|
||||
@@ -684,6 +705,15 @@ void RCInput::Run()
|
||||
} else {
|
||||
// disable CPPM input by mapping it away from the timer capture input
|
||||
px4_arch_unconfiggpio(GPIO_PPM_IN);
|
||||
|
||||
#ifdef RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
if (strcmp(_device, RC_SERIAL_PORT) == 0) {
|
||||
px4_arch_configgpio(RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX);
|
||||
}
|
||||
|
||||
#endif // RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX
|
||||
|
||||
// Scan the next protocol
|
||||
set_rc_scan_state(RC_SCAN_CRSF);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user