Skip to content

Commit 2e6930a

Browse files
committed
Decouple Wire/SPI singletons from mbed definitions
1 parent c216bd2 commit 2e6930a

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

libraries/SPI/SPI.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ void arduino::MbedSPI::end() {
8181

8282
#if !defined(ARDUINO_AS_MBED_LIBRARY)
8383

84-
#if DEVICE_SPI > 0
84+
#if SPI_HOWMANY > 0
8585
arduino::MbedSPI SPI(SPI_MISO, SPI_MOSI, SPI_SCK);
8686
#endif
87-
#if DEVICE_SPI > 1
87+
#if SPI_HOWMANY > 1
8888
arduino::MbedSPI SPI1(SPI_MISO1, SPI_MOSI1, SPI_SCK1);
8989
#endif
9090

libraries/SPI/SPI.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ class MbedSPI : public SPIClass
6060

6161
#if !defined(ARDUINO_AS_MBED_LIBRARY)
6262

63-
#if DEVICE_SPI > 0
63+
#if SPI_HOWMANY > 0
6464
extern arduino::MbedSPI SPI;
6565
#endif
66-
#if DEVICE_SPI > 1
66+
#if SPI_HOWMANY > 1
6767
extern arduino::MbedSPI SPI1;
6868
#endif
6969

libraries/Wire/Wire.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ void arduino::MbedI2C::onReceive(void(*)(int)) {}
123123
void arduino::MbedI2C::onRequest(void(*)(void)) {}
124124

125125

126-
#if DEVICE_I2C > 0
126+
#if WIRE_HOWMANY > 0
127127
arduino::MbedI2C Wire(I2C_SDA, I2C_SCL);
128128
#endif
129-
#if DEVICE_I2C > 1
129+
#if WIRE_HOWMANY > 1
130130
arduino::MbedI2C Wire1(I2C_SDA1, I2C_SCL1);;
131131
#endif

libraries/Wire/Wire.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class MbedI2C : public HardwareI2C
6767

6868
}
6969

70-
#if DEVICE_I2C > 0
70+
#if WIRE_HOWMANY > 0
7171
extern arduino::MbedI2C Wire;
7272
#endif
73-
#if DEVICE_I2C > 1
73+
#if WIRE_HOWMANY > 1
7474
extern arduino::MbedI2C Wire1;
7575
#endif
7676

variants/ARDUINO_NANO33BLE/pins_arduino.h

+4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,15 @@ static const uint8_t SCK = PIN_SPI_SCK;
123123

124124
#define DFU_MAGIC_SERIAL_ONLY_RESET 0xb0
125125

126+
#define WIRE_HOWMANY 2
127+
126128
#define I2C_SDA (digitalPinToPinName(PIN_WIRE_SDA))
127129
#define I2C_SCL (digitalPinToPinName(PIN_WIRE_SCL))
128130
#define I2C_SDA1 (digitalPinToPinName(PIN_WIRE_SDA1))
129131
#define I2C_SCL1 (digitalPinToPinName(PIN_WIRE_SCL1))
130132

133+
#define SPI_HOWMANY 1
134+
131135
#define SPI_MISO (digitalPinToPinName(PIN_SPI_MISO))
132136
#define SPI_MOSI (digitalPinToPinName(PIN_SPI_MOSI))
133137
#define SPI_SCK (digitalPinToPinName(PIN_SPI_SCK))

0 commit comments

Comments
 (0)