From f0e77840dccb2fa409e8c6d8ddfc517e168e1727 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Jul 2020 22:19:06 +0200 Subject: [PATCH] cpu/nrf52: spi_twi_irq add workaround for nRF52810 vendor file Either nRF52810 should define SPIM_COUNT 2 or nRF52805 should define SPIM_COUNT 1. But as it nRF52805 defines SPIM_COUNT 2 and nRF52810 defines SPIM_COUNT 1 even though both have a single SPI and a single, separate TWI peripheral. Re-define SPIM_COUNT to 2 on nRF52810 as this is the easiest solution. --- cpu/nrf52/spi_twi_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cpu/nrf52/spi_twi_irq.c b/cpu/nrf52/spi_twi_irq.c index 81b2836db1..eb32412741 100644 --- a/cpu/nrf52/spi_twi_irq.c +++ b/cpu/nrf52/spi_twi_irq.c @@ -40,6 +40,19 @@ #endif +/** + * The vendor file is weird here. nRF52805 is the only other MCU + * that has only 1 SPI and separate 1 TWI interface, but define + * SPIM_COUNT = 2, which is in line with how it is used here. + * nRF52810 has the same set of SPI/TWI peripherals, but defines + * SPIM_COUNT = 1 which is more logical. + * Just re-define it to work around this inconsistency. + */ +#ifdef CPU_MODEL_NRF52810XXAA +#undef SPIM_COUNT +#define SPIM_COUNT 2 +#endif + static spi_twi_irq_cb_t _irq[SPIM_COUNT]; static void *_irq_arg[SPIM_COUNT];