diff --git a/boards/airmind/mindpx-v2/src/board_config.h b/boards/airmind/mindpx-v2/src/board_config.h index bbd6d37c95..310b2fef81 100644 --- a/boards/airmind/mindpx-v2/src/board_config.h +++ b/boards/airmind/mindpx-v2/src/board_config.h @@ -95,7 +95,6 @@ /* AUX PWMs */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* USB OTG FS * diff --git a/boards/av/x-v1/src/board_config.h b/boards/av/x-v1/src/board_config.h index f3d965bdea..91dfa83b17 100644 --- a/boards/av/x-v1/src/board_config.h +++ b/boards/av/x-v1/src/board_config.h @@ -101,7 +101,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 9 -#define DIRECT_INPUT_TIMER_CHANNELS 9 #define BOARD_CAPTURE_GPIO /* PD14 */ (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN14) diff --git a/boards/cubepilot/io-v2/src/board_config.h b/boards/cubepilot/io-v2/src/board_config.h index 1a83e88445..d238caaafa 100644 --- a/boards/cubepilot/io-v2/src/board_config.h +++ b/boards/cubepilot/io-v2/src/board_config.h @@ -47,8 +47,6 @@ #include #include -#include - /****************************************************************************** * Definitions ******************************************************************************/ @@ -135,6 +133,7 @@ #define GPIO_PWM8 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1) #define DIRECT_PWM_OUTPUT_CHANNELS 8 +#define BOARD_HAS_NO_CAPTURE /* SBUS pins *************************************************************/ @@ -166,3 +165,6 @@ #define BOARD_NUM_IO_TIMERS 3 #define BOARD_DISABLE_I2C_SPI + + +#include diff --git a/boards/holybro/durandal-v1/src/board_config.h b/boards/holybro/durandal-v1/src/board_config.h index c48f827b4a..1b274fa88d 100644 --- a/boards/holybro/durandal-v1/src/board_config.h +++ b/boards/holybro/durandal-v1/src/board_config.h @@ -202,7 +202,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 5 -#define DIRECT_INPUT_TIMER_CHANNELS 5 #define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4}; diff --git a/boards/holybro/kakutef7/src/board_config.h b/boards/holybro/kakutef7/src/board_config.h index b575b7aabc..22ff18eba6 100644 --- a/boards/holybro/kakutef7/src/board_config.h +++ b/boards/holybro/kakutef7/src/board_config.h @@ -100,7 +100,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* Tone alarm output */ #define GPIO_TONE_ALARM_IDLE /* PD15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN15) diff --git a/boards/holybro/pix32v5/src/board_config.h b/boards/holybro/pix32v5/src/board_config.h index e1ce508102..2229379bef 100644 --- a/boards/holybro/pix32v5/src/board_config.h +++ b/boards/holybro/pix32v5/src/board_config.h @@ -239,7 +239,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_HAS_LED_PWM 1 #define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1 diff --git a/boards/modalai/fc-v1/src/board_config.h b/boards/modalai/fc-v1/src/board_config.h index cfedebd226..91411b9398 100644 --- a/boards/modalai/fc-v1/src/board_config.h +++ b/boards/modalai/fc-v1/src/board_config.h @@ -150,7 +150,6 @@ */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define GPIO_CAN1_SILENT /* PI11 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTI|GPIO_PIN11) diff --git a/boards/modalai/fc-v2/src/board_config.h b/boards/modalai/fc-v2/src/board_config.h index 90767cda79..581fb19344 100644 --- a/boards/modalai/fc-v2/src/board_config.h +++ b/boards/modalai/fc-v2/src/board_config.h @@ -209,7 +209,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; diff --git a/boards/mro/ctrl-zero-f7-oem/src/board_config.h b/boards/mro/ctrl-zero-f7-oem/src/board_config.h index ace3fc7b70..12d15053d1 100644 --- a/boards/mro/ctrl-zero-f7-oem/src/board_config.h +++ b/boards/mro/ctrl-zero-f7-oem/src/board_config.h @@ -108,7 +108,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Power supply control and monitoring GPIOs */ #define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) diff --git a/boards/mro/ctrl-zero-f7/src/board_config.h b/boards/mro/ctrl-zero-f7/src/board_config.h index fda06e8eac..f920e55171 100644 --- a/boards/mro/ctrl-zero-f7/src/board_config.h +++ b/boards/mro/ctrl-zero-f7/src/board_config.h @@ -107,7 +107,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Power supply control and monitoring GPIOs */ #define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) diff --git a/boards/mro/ctrl-zero-h7-oem/src/board_config.h b/boards/mro/ctrl-zero-h7-oem/src/board_config.h index d78ca46680..a5b3690efc 100644 --- a/boards/mro/ctrl-zero-h7-oem/src/board_config.h +++ b/boards/mro/ctrl-zero-h7-oem/src/board_config.h @@ -81,7 +81,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Power supply control and monitoring GPIOs */ #define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) diff --git a/boards/mro/ctrl-zero-h7/src/board_config.h b/boards/mro/ctrl-zero-h7/src/board_config.h index 935bcc974e..15e6183d1a 100644 --- a/boards/mro/ctrl-zero-h7/src/board_config.h +++ b/boards/mro/ctrl-zero-h7/src/board_config.h @@ -80,7 +80,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Power supply control and monitoring GPIOs */ #define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) diff --git a/boards/mro/pixracerpro/src/board_config.h b/boards/mro/pixracerpro/src/board_config.h index 27868b2a00..d2aeacf48a 100644 --- a/boards/mro/pixracerpro/src/board_config.h +++ b/boards/mro/pixracerpro/src/board_config.h @@ -84,7 +84,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Power supply control and monitoring GPIOs */ #define GPIO_nPOWER_IN_A /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) diff --git a/boards/mro/x21-777/src/board_config.h b/boards/mro/x21-777/src/board_config.h index 1fcd22be68..30abf1e467 100644 --- a/boards/mro/x21-777/src/board_config.h +++ b/boards/mro/x21-777/src/board_config.h @@ -91,7 +91,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* USB OTG FS * diff --git a/boards/mro/x21/src/board_config.h b/boards/mro/x21/src/board_config.h index 23f306f69c..be6da1a332 100644 --- a/boards/mro/x21/src/board_config.h +++ b/boards/mro/x21/src/board_config.h @@ -102,7 +102,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* USB OTG FS * diff --git a/boards/nxp/fmuk66-e/src/board_config.h b/boards/nxp/fmuk66-e/src/board_config.h index 549f458f30..44a6151aa8 100644 --- a/boards/nxp/fmuk66-e/src/board_config.h +++ b/boards/nxp/fmuk66-e/src/board_config.h @@ -270,7 +270,6 @@ __END_DECLS // todo:Design this! #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define GPIO_ULTRASOUND_TRIGGER /* PTD0 */ (GPIO_LOWDRIVE | GPIO_OUTPUT_ZERO | PIN_PORTD | PIN0) #define GPIO_ULTRASOUND_ECHO /* PTA10 */ (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTA | PIN10) diff --git a/boards/nxp/fmuk66-v3/src/board_config.h b/boards/nxp/fmuk66-v3/src/board_config.h index 8bc7bcc71a..6da58c0b0b 100644 --- a/boards/nxp/fmuk66-v3/src/board_config.h +++ b/boards/nxp/fmuk66-v3/src/board_config.h @@ -274,7 +274,6 @@ __END_DECLS // todo:Design this! #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 #define GPIO_ULTRASOUND_TRIGGER /* PTD0 */ (GPIO_LOWDRIVE | GPIO_OUTPUT_ZERO | PIN_PORTD | PIN0) #define GPIO_ULTRASOUND_ECHO /* PTA10 */ (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTA | PIN10) diff --git a/boards/nxp/fmurt1062-v1/src/board_config.h b/boards/nxp/fmurt1062-v1/src/board_config.h index a8655d3f8c..cbc1820d80 100644 --- a/boards/nxp/fmurt1062-v1/src/board_config.h +++ b/boards/nxp/fmurt1062-v1/src/board_config.h @@ -241,7 +241,7 @@ // Input Capture not supported on MVP -#define DIRECT_INPUT_TIMER_CHANNELS 0 +#define BOARD_HAS_NO_CAPTURE //#define BOARD_HAS_UI_LED_PWM 1 Not ported yet (Still Kinetis driver) #define BOARD_HAS_LED_PWM 1 diff --git a/boards/omnibus/f4sd/src/board_config.h b/boards/omnibus/f4sd/src/board_config.h index 92b36c422f..8b39d66c88 100644 --- a/boards/omnibus/f4sd/src/board_config.h +++ b/boards/omnibus/f4sd/src/board_config.h @@ -119,7 +119,6 @@ * Alternatively CH3/CH4 could be assigned to UART6_TX/RX */ #define DIRECT_PWM_OUTPUT_CHANNELS 4 -#define DIRECT_INPUT_TIMER_CHANNELS 4 /* High-resolution timer */ #define HRT_TIMER 4 // T4C1 diff --git a/boards/px4/fmu-v2/src/board_config.h b/boards/px4/fmu-v2/src/board_config.h index 7ece93b2cf..59d5228361 100644 --- a/boards/px4/fmu-v2/src/board_config.h +++ b/boards/px4/fmu-v2/src/board_config.h @@ -131,7 +131,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* USB OTG FS * diff --git a/boards/px4/fmu-v3/src/board_config.h b/boards/px4/fmu-v3/src/board_config.h index 3fdc9b5dc5..e0a483b5ee 100644 --- a/boards/px4/fmu-v3/src/board_config.h +++ b/boards/px4/fmu-v3/src/board_config.h @@ -131,7 +131,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* USB OTG FS * diff --git a/boards/px4/fmu-v4/src/board_config.h b/boards/px4/fmu-v4/src/board_config.h index 58e872a893..48dd3736f7 100644 --- a/boards/px4/fmu-v4/src/board_config.h +++ b/boards/px4/fmu-v4/src/board_config.h @@ -104,7 +104,6 @@ * Six PWM outputs are configured. */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /** * USB OTG FS: diff --git a/boards/px4/fmu-v4pro/src/board_config.h b/boards/px4/fmu-v4pro/src/board_config.h index f52e143d28..1a0de13ee0 100644 --- a/boards/px4/fmu-v4pro/src/board_config.h +++ b/boards/px4/fmu-v4pro/src/board_config.h @@ -148,7 +148,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /* USB OTG FS * diff --git a/boards/px4/fmu-v5/src/board_config.h b/boards/px4/fmu-v5/src/board_config.h index e02ee6798a..cd1398f585 100644 --- a/boards/px4/fmu-v5/src/board_config.h +++ b/boards/px4/fmu-v5/src/board_config.h @@ -240,7 +240,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_HAS_LED_PWM 1 #define BOARD_LED_PWM_DRIVE_ACTIVE_LOW 1 diff --git a/boards/px4/fmu-v5x/src/board_config.h b/boards/px4/fmu-v5x/src/board_config.h index ee78d22504..99a15fbaaf 100644 --- a/boards/px4/fmu-v5x/src/board_config.h +++ b/boards/px4/fmu-v5x/src/board_config.h @@ -231,7 +231,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; diff --git a/boards/px4/fmu-v6u/src/board_config.h b/boards/px4/fmu-v6u/src/board_config.h index c36ffcad5e..3d8dfb99e3 100644 --- a/boards/px4/fmu-v6u/src/board_config.h +++ b/boards/px4/fmu-v6u/src/board_config.h @@ -217,7 +217,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; diff --git a/boards/px4/fmu-v6x/src/board_config.h b/boards/px4/fmu-v6x/src/board_config.h index 2e5429d3b8..8b65ef0b16 100644 --- a/boards/px4/fmu-v6x/src/board_config.h +++ b/boards/px4/fmu-v6x/src/board_config.h @@ -257,7 +257,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 #define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5, 6, 7}; diff --git a/boards/px4/io-v2/src/board_config.h b/boards/px4/io-v2/src/board_config.h index 1a83e88445..e84a6c0e20 100644 --- a/boards/px4/io-v2/src/board_config.h +++ b/boards/px4/io-v2/src/board_config.h @@ -47,8 +47,6 @@ #include #include -#include - /****************************************************************************** * Definitions ******************************************************************************/ @@ -135,6 +133,7 @@ #define GPIO_PWM8 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1) #define DIRECT_PWM_OUTPUT_CHANNELS 8 +#define BOARD_HAS_NO_CAPTURE /* SBUS pins *************************************************************/ @@ -166,3 +165,5 @@ #define BOARD_NUM_IO_TIMERS 3 #define BOARD_DISABLE_I2C_SPI + +#include diff --git a/boards/spracing/h7extreme/src/board_config.h b/boards/spracing/h7extreme/src/board_config.h index 408a17968d..67b57c94fc 100644 --- a/boards/spracing/h7extreme/src/board_config.h +++ b/boards/spracing/h7extreme/src/board_config.h @@ -96,7 +96,6 @@ /* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 8 -#define DIRECT_INPUT_TIMER_CHANNELS 8 /* Tone alarm output */ #define GPIO_TONE_ALARM_IDLE /* PE5 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN5) diff --git a/boards/uvify/core/src/board_config.h b/boards/uvify/core/src/board_config.h index 60ce9f32fb..ccb1a4a0a0 100644 --- a/boards/uvify/core/src/board_config.h +++ b/boards/uvify/core/src/board_config.h @@ -101,7 +101,6 @@ * PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 /** * USB OTG FS: diff --git a/platforms/common/include/px4_platform_common/board_common.h b/platforms/common/include/px4_platform_common/board_common.h index d94cb1e051..bb438f3ad2 100644 --- a/platforms/common/include/px4_platform_common/board_common.h +++ b/platforms/common/include/px4_platform_common/board_common.h @@ -240,13 +240,6 @@ # define BOARD_EEPROM_WP_CTRL(on_true) #endif -/* - * Defined when a board has capture and uses channels. - */ -#if defined(DIRECT_INPUT_TIMER_CHANNELS) && DIRECT_INPUT_TIMER_CHANNELS > 0 -#define BOARD_HAS_CAPTURE 1 -#endif - /* * Defined when a supports version and type API. */ diff --git a/platforms/nuttx/src/px4/stm/stm32_common/io_pins/input_capture.c b/platforms/nuttx/src/px4/stm/stm32_common/io_pins/input_capture.c index fa875fe20d..61fd70ee88 100644 --- a/platforms/nuttx/src/px4/stm/stm32_common/io_pins/input_capture.c +++ b/platforms/nuttx/src/px4/stm/stm32_common/io_pins/input_capture.c @@ -77,7 +77,7 @@ #include #include -#if defined(BOARD_HAS_CAPTURE) +#if !defined(BOARD_HAS_NO_CAPTURE) /* Support Input capture */ @@ -497,4 +497,4 @@ int up_input_capture_get_stats(unsigned channel, input_capture_stats_t *stats, b return rv; } -#endif // defined(BOARD_HAS_CAPTURE) +#endif // !defined(BOARD_HAS_NO_CAPTURE) diff --git a/platforms/nuttx/src/px4/stm/stm32_common/io_pins/io_timer.c b/platforms/nuttx/src/px4/stm/stm32_common/io_pins/io_timer.c index 23deb5d5b8..7106319354 100644 --- a/platforms/nuttx/src/px4/stm/stm32_common/io_pins/io_timer.c +++ b/platforms/nuttx/src/px4/stm/stm32_common/io_pins/io_timer.c @@ -156,7 +156,7 @@ typedef uint8_t io_timer_allocation_t; /* big enough to hold MAX_IO_TIMERS */ io_timer_channel_allocation_t timer_allocations[MAX_IO_TIMERS] = { }; -#if defined(BOARD_HAS_CAPTURE) +#if !defined(BOARD_HAS_NO_CAPTURE) /* Stats and handlers are only useful for Capture */ @@ -171,12 +171,12 @@ static struct channel_handler_entry { channel_handler_t callback; void *context; } channel_handlers[MAX_TIMER_IO_CHANNELS]; -#endif // defined(BOARD_HAS_CAPTURE) +#endif // !defined(BOARD_HAS_NO_CAPTURE) static int io_timer_handler(uint16_t timer_index) { -#if defined(BOARD_HAS_CAPTURE) +#if !defined(BOARD_HAS_NO_CAPTURE) /* Read the count at the time of the interrupt */ uint16_t count = rCNT(timer_index); @@ -231,7 +231,7 @@ static int io_timer_handler(uint16_t timer_index) /* Clear all the SR bits for interrupt enabled channels only */ rSR(timer_index) = ~(statusr & (enabled | enabled << 8)); -#endif // defined(BOARD_HAS_CAPTURE) +#endif // !defined(BOARD_HAS_NO_CAPTURE) return 0; } @@ -773,7 +773,7 @@ int io_timer_channel_init(unsigned channel, io_timer_channel_mode_t mode, gpio = timer_io_channels[channel].gpio_in; break; -#if defined(BOARD_HAS_CAPTURE) +#if !defined(BOARD_HAS_NO_CAPTURE) case IOTimerChanMode_Capture: setbits = CCMR_C1_CAPTURE_INIT; @@ -851,7 +851,7 @@ int io_timer_channel_init(unsigned channel, io_timer_channel_mode_t mode, rvalue |= setbits; rCCER(timer) = rvalue; -#if !defined(BOARD_HAS_CAPTURE) +#if defined(BOARD_HAS_NO_CAPTURE) UNUSED(dier_setbits); #else channel_handlers[channel].callback = channel_handler;