px4/fmu-v5: add capture pins to list of pwm pins

This commit is contained in:
Beat Küng 2021-09-15 14:01:37 +02:00 committed by Daniel Agar
parent a01cf2efc0
commit 0ab4a24de8
3 changed files with 6 additions and 31 deletions

View File

@ -212,22 +212,6 @@
#define HEATER_OUTPUT_EN(on_true) px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, (on_true))
/* PWM Capture
*
* 3 PWM Capture inputs are configured.
*
* Pins:
*
* FMU_CAP1 : PA5 : TIM2_CH1
* FMU_CAP2 : PB3 : TIM2_CH2
* FMU_CAP3 : PB11 : TIM2_CH4
*/
#define GPIO_TIM2_CH1_IN /* PA5 T22C1 FMU_CAP1 */ GPIO_TIM2_CH1IN_3
#define GPIO_TIM2_CH2_IN /* PB3 T22C2 FMU_CAP2 */ GPIO_TIM2_CH2IN_2
#define GPIO_TIM2_CH4_IN /* PB11 T22C4 FMU_CAP3 */ GPIO_TIM2_CH4IN_2
#define DIRECT_PWM_CAPTURE_CHANNELS 3
/* PI0 is nARMED
* The GPIO will be set as input while not armed HW will have external HW Pull UP.
* While armed it shall be configured at a GPIO OUT set LOW
@ -239,7 +223,7 @@
/* PWM
*/
#define DIRECT_PWM_OUTPUT_CHANNELS 8
#define DIRECT_PWM_OUTPUT_CHANNELS 11
#define BOARD_HAS_LED_PWM 1
#define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1
@ -310,19 +294,6 @@
#define RC_SERIAL_SINGLEWIRE
#define BOARD_SUPPORTS_RC_SERIAL_PORT_OUTPUT
/* Input Capture Channels. */
#define INPUT_CAP1_TIMER 2
#define INPUT_CAP1_CHANNEL /* T4C1 */ 1
#define GPIO_INPUT_CAP1 /* PA5 */ GPIO_TIM2_CH1_IN
#define INPUT_CAP2_TIMER 2
#define INPUT_CAP2_CHANNEL /* T4C2 */ 2
#define GPIO_INPUT_CAP2 /* PB3 */ GPIO_TIM2_CH2_IN
#define INPUT_CAP3_TIMER 2
#define INPUT_CAP3_CHANNEL /* T4C4 */ 4
#define GPIO_INPUT_CAP3 /* PB11 */ GPIO_TIM2_CH4_IN
/* PWM input driver. Use FMU AUX5 pins attached to timer4 channel 2 */
#define PWMIN_TIMER 4
#define PWMIN_TIMER_CHANNEL /* T4C2 */ 2
@ -470,7 +441,7 @@
#define BOARD_NUM_IO_TIMERS 5
#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7};
#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10};
__BEGIN_DECLS

View File

@ -50,6 +50,9 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}),
initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}),
initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel1}, {GPIO::PortA, GPIO::Pin5}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel2}, {GPIO::PortB, GPIO::Pin3}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel4}, {GPIO::PortB, GPIO::Pin11}),
};
constexpr io_timers_channel_mapping_t io_timers_channel_mapping =

View File

@ -43,6 +43,7 @@
static inline constexpr timer_io_channels_t initIOTimerGPIOInOut(Timer::TimerChannel timer, GPIO::GPIOPin pin);
#define initIOTimerChannelCapture initIOTimerChannel // alias, used for param metadata generation
static inline constexpr timer_io_channels_t initIOTimerChannel(const io_timers_t io_timers_conf[MAX_IO_TIMERS],
Timer::TimerChannel timer, GPIO::GPIOPin pin)