From 45248805811492e17bf8d98ef1f0c865cfa0fcff Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Date: Wed, 20 Sep 2023 10:49:40 +0200
Subject: [PATCH] boards/nucleo64: fix SPI Arduino mapping for most boards

Before, the Arduino SPI mapping for all Nucleo-64 boards was
incorrect. With this, the situation improves to the following:

- [x] nucleo-f030r8
- [ ] nucleo-f070rb
    - No SPI buses provided
- [x] nucleo-f072rb
- [x] nucleo-f091rc
- [x] nucleo-f103rb
- [ ] nucleo-f302r8
    - No SPI bus at D11, D12, D13 provided
- [x] nucleo-f303re
- [x] nucleo-f334r8
- [x] nucleo-f401re
- [x] nucleo-f410rb
- [x] nucleo-f411re
- [x] nucleo-f446re
- [x] nucleo-g070rb
- [x] nucleo-g071rb
- [x] nucleo-g431rb
- [x] nucleo-g474re
- [x] nucleo-l053r8
- [x] nucleo-l073rz
- [x] nucleo-l152re
- [ ] nucleo-l433rc
    - No SPI bus at D11, D12, D13 provided
- [x] nucleo-l452re
- [x] nucleo-l476rg
- [x] nucleo-wl55jc

The remaining offenders still need to be fixed, but that is better done
one PR at a time.
---
 boards/common/nucleo64/include/arduino_iomap.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/boards/common/nucleo64/include/arduino_iomap.h b/boards/common/nucleo64/include/arduino_iomap.h
index 4844271eeec1..c6debeedc367 100644
--- a/boards/common/nucleo64/include/arduino_iomap.h
+++ b/boards/common/nucleo64/include/arduino_iomap.h
@@ -24,6 +24,7 @@
 
 #include "periph/gpio.h"
 #include "periph/adc.h"
+#include "periph_conf.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -43,7 +44,9 @@ extern "C" {
 /**
  * @brief   SPI_DEV(1) is connected to D11/D12/D13
  */
-#define ARDUINO_SPI_D11D12D13   SPI_DEV(1)
+#if !defined(ARDUINO_SPI_D11D12D13) && defined(SPI_NUMOF)
+#define ARDUINO_SPI_D11D12D13   SPI_DEV(0)
+#endif
 /** @} */
 
 /**