From 6b1ee7bbe2b3348c969668b37b12dbbe3913e2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Fri, 31 Jan 2020 10:41:09 +0100 Subject: [PATCH] io_timer_init.h: avoid using timer_channel, as imxrt does not have it --- .../src/px4/common/include/px4_platform/io_timer_init.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/nuttx/src/px4/common/include/px4_platform/io_timer_init.h b/platforms/nuttx/src/px4/common/include/px4_platform/io_timer_init.h index 14576759b05e..fd6d8902830f 100644 --- a/platforms/nuttx/src/px4/common/include/px4_platform/io_timer_init.h +++ b/platforms/nuttx/src/px4/common/include/px4_platform/io_timer_init.h @@ -61,7 +61,7 @@ static inline constexpr io_timers_channel_mapping_t initIOTimerChannelMapping(co uint32_t channel_count = 0; for (uint32_t channel = 0; channel < MAX_TIMER_IO_CHANNELS; ++channel) { - if (timer_io_channels_conf[channel].timer_channel == 0) { + if (timer_io_channels_conf[channel].gpio_in == 0 && timer_io_channels_conf[channel].gpio_out == 0) { break; } @@ -88,7 +88,8 @@ static inline constexpr io_timers_channel_mapping_t initIOTimerChannelMapping(co // validate that the number of configured channels matches DIRECT_PWM_OUTPUT_CHANNELS uint32_t num_channels = 0; - while (num_channels < MAX_TIMER_IO_CHANNELS && timer_io_channels_conf[num_channels].timer_channel != 0) { + while (num_channels < MAX_TIMER_IO_CHANNELS && + (timer_io_channels_conf[num_channels].gpio_in != 0 || timer_io_channels_conf[num_channels].gpio_out != 0)) { ++num_channels; }