Skip to content

Commit 84f8235

Browse files
anangldleach02
authored andcommitted
drivers: spi_nrfx_spim: Fix handling of extended SPIM configuration
Fill the `rx_delay` field in the SPIM configuration structure only when the RXDELAY feature is present in a given SPIM instance, to prevent compilation errors when some other SPIM instance is enabled together with SPIM3. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 58e2057 commit 84f8235

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/spi/spi_nrfx_spim.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ static int spim_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
360360
}
361361
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
362362

363-
#if NRFX_CHECK(NRFX_SPIM_EXTENDED_ENABLED)
364-
#define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \
365-
.rx_delay = CONFIG_SPI_##idx##_NRF_RX_DELAY,
366-
#else
367-
#define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx)
368-
#endif
363+
#define SPI_NRFX_SPIM_EXTENDED_CONFIG(idx) \
364+
COND_CODE_1(IS_ENABLED(NRFX_SPIM_EXTENDED_ENABLED), \
365+
(COND_CODE_1(SPIM##idx##_FEATURE_RXDELAY_PRESENT, \
366+
(.rx_delay = CONFIG_SPI_##idx##_NRF_RX_DELAY,), \
367+
())), \
368+
())
369369

370370
#define SPI_NRFX_SPIM_DEVICE(idx) \
371371
static int spi_##idx##_init(struct device *dev) \

0 commit comments

Comments
 (0)