Browse Source

holybro/durandal-v1: add capture pins to list of pwm pins

master
Beat Küng 3 years ago committed by Daniel Agar
parent
commit
d9bf03b2dc
  1. 55
      boards/holybro/durandal-v1/src/board_config.h
  2. 8
      boards/holybro/durandal-v1/src/timer_config.cpp
  3. 2
      platforms/nuttx/src/px4/stm/stm32h7/include/px4_arch/io_timer_hw_description.h

55
boards/holybro/durandal-v1/src/board_config.h

@ -176,34 +176,13 @@ @@ -176,34 +176,13 @@
#define GPIO_HEATER_OUTPUT /* PA7 T14CH1 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN7)
#define HEATER_OUTPUT_EN(on_true) px4_arch_gpiowrite(GPIO_HEATER_OUTPUT, (on_true))
/* PWM Capture
*
* 6 PWM Capture inputs are configured.
*
* Pins:
*
* FMU_CAP1 : PB11 : TIM2_CH4
* FMU_CAP2 : PB3 : TIM2_CH2
* FMU_CAP3 : PA5 : TIM2_CH1
* FMU_CAP4 : PH9 : TIM12_CH2
* FMU_CAP5 : PH6 : TIM12_CH1
* FMU_CAP6 : PD14 : TIM4_CH3
*/
#define GPIO_TIM2_CH4_IN /* PB11 FMU_CAP3 */ GPIO_TIM2_CH4IN_2
#define GPIO_TIM2_CH2_IN /* PB3 FMU_CAP2 */ GPIO_TIM2_CH2IN_2
#define GPIO_TIM2_CH1_IN /* PA5 FMU_CAP1 */ GPIO_TIM2_CH1IN_3
#define GPIO_TIM12_CH2_IN /* PH9 FMU_CAP4 */ GPIO_TIM12_CH2IN_2
#define GPIO_TIM12_CH1_IN /* PH6 FMU_CAP5 */ GPIO_TIM12_CH1IN_2
#define GPIO_TIM4_CH3_IN /* PD14 FMU_CAP6 */ GPIO_TIM4_CH3IN_2
#define DIRECT_PWM_CAPTURE_CHANNELS 6
/* PWM
*/
#define DIRECT_PWM_OUTPUT_CHANNELS 5
#define DIRECT_PWM_OUTPUT_CHANNELS 10
#define BOARD_NUM_IO_TIMERS 4
#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4};
#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7, 9, 8};
/* Power supply control and monitoring GPIOs */
@ -254,32 +233,6 @@ @@ -254,32 +233,6 @@
/* RC Serial port */
/* Input Capture Channels. */
#define INPUT_CAP1_TIMER 2
#define INPUT_CAP1_CHANNEL /* T2C4 */ 4
#define GPIO_INPUT_CAP1 /* PB11 */ GPIO_TIM2_CH4_IN
#define INPUT_CAP2_TIMER 2
#define INPUT_CAP2_CHANNEL /* T2C2 */ 2
#define GPIO_INPUT_CAP2 /* PB3 */ GPIO_TIM2_CH2_IN
#define INPUT_CAP3_TIMER 2
#define INPUT_CAP3_CHANNEL /* T2C1 */ 1
#define GPIO_INPU3_CAP1 /* PA5 */ GPIO_TIM2_CH1_IN
#define INPUT_CAP4_TIMER 12
#define INPUT_CAP4_CHANNEL /* T12C2*/ 2
#define GPIO_INPUT_CAP4 /* PH9 */ GPIO_TIM12_CH2_IN
#define INPUT_CAP5_TIMER 12
#define INPUT_CAP5_CHANNEL /* T12C1*/ 1
#define GPIO_INPUT_CAP5 /* PH6 */ GPIO_TIM12_CH1_IN
#define INPUT_CAP6_TIMER 4
#define INPUT_CAP6_CHANNEL /* T4C3 */ 3
#define GPIO_INPUT_CAP6 /* PD14 */ GPIO_TIM4_CH3_IN
/* PWM input driver. Use FMU AUX5 pins attached to timer4 channel 2 */
#define PWMIN_TIMER 4

8
boards/holybro/durandal-v1/src/timer_config.cpp

@ -36,6 +36,8 @@ @@ -36,6 +36,8 @@
constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {
initIOTimer(Timer::Timer1, DMA{DMA::Index1}),
initIOTimer(Timer::Timer4, DMA{DMA::Index1}),
initIOTimer(Timer::Timer2),
initIOTimer(Timer::Timer12),
};
constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
@ -44,6 +46,12 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { @@ -44,6 +46,12 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}),
initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}),
initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel4}, {GPIO::PortB, GPIO::Pin11}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel2}, {GPIO::PortB, GPIO::Pin3}),
initIOTimerChannelCapture(io_timers, {Timer::Timer2, Timer::Channel1}, {GPIO::PortA, GPIO::Pin5}),
initIOTimerChannelCapture(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}),
initIOTimerChannelCapture(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}),
//initIOTimerChannelCapture(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}),
};
constexpr io_timers_channel_mapping_t io_timers_channel_mapping =

2
platforms/nuttx/src/px4/stm/stm32h7/include/px4_arch/io_timer_hw_description.h

@ -39,6 +39,8 @@ @@ -39,6 +39,8 @@
#include <px4_platform/io_timer_init.h>
#include <stm32_tim.h>
#define initIOTimerChannelCapture initIOTimerChannel // alias, used for param metadata generation
static inline constexpr timer_io_channels_t initIOTimerGPIOInOut(Timer::TimerChannel timer, GPIO::GPIOPin pin)
{
timer_io_channels_t ret{};

Loading…
Cancel
Save