Commit edc3e314 authored by Sandeep Mistry's avatar Sandeep Mistry

Check WIRE_INTERFACES_COUNT and SPI_INTERFACES_COUNT

parent 9a56aec0
......@@ -244,4 +244,6 @@ void SPIClass::detachInterrupt() {
// Should be disableInterrupt()
}
#if SPI_INTERFACES_COUNT > 0
SPIClass SPI (NRF_SPI0, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI);
#endif
......@@ -133,9 +133,9 @@ void SPIClass::transfer(void *buf, size_t count)
buffer[i] = transfer(buffer[i]);
}
#if SPI_INTERFACES_COUNT > 0
extern SPIClass SPI;
extern SPIClass SPI1;
extern SPIClass SPI2;
#endif
// For compatibility with sketches designed for AVR @ 16 MHz
// New programs should use SPI.beginTransaction to set the SPI clock
......
......@@ -103,6 +103,8 @@ class TwoWire : public Stream
static const uint32_t TWI_CLOCK = 100000;
};
#if WIRE_INTERFACES_COUNT > 0
extern TwoWire Wire;
#endif
#endif
......@@ -281,6 +281,7 @@ void TwoWire::onService(void)
{
}
#if WIRE_INTERFACES_COUNT > 0
TwoWire Wire(NRF_TWI1, SPI1_TWI1_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL);
extern "C"
......@@ -290,5 +291,6 @@ extern "C"
Wire.onService();
}
}
#endif
#endif
......@@ -386,6 +386,7 @@ void TwoWire::onService(void)
TwoWire Wire(NRF_TWIM1, NRF_TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL);
#if WIRE_INTERFACES_COUNT > 0
extern "C"
{
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void)
......@@ -393,5 +394,6 @@ extern "C"
Wire.onService();
}
}
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment