Skip to content

Commit 85798d1

Browse files
jhmaloneysandeepmistry
authored andcommitted
Add support for secondary Wire1 interface
1 parent 4c9101d commit 85798d1

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

libraries/Wire/Wire.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,8 @@ class TwoWire : public Stream
108108
extern TwoWire Wire;
109109
#endif
110110

111+
#if WIRE_INTERFACES_COUNT > 1
112+
extern TwoWire Wire1;
113+
#endif
114+
111115
#endif

libraries/Wire/Wire_nRF51.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,8 @@ void TwoWire::flush(void)
309309
TwoWire Wire(NRF_TWI1, PIN_WIRE_SDA, PIN_WIRE_SCL);
310310
#endif
311311

312+
#if WIRE_INTERFACES_COUNT > 1
313+
TwoWire Wire1(NRF_TWI0, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
314+
#endif
315+
312316
#endif

libraries/Wire/Wire_nRF52.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,17 @@ extern "C"
413413
}
414414
#endif
415415

416+
#if WIRE_INTERFACES_COUNT > 1
417+
418+
TwoWire Wire1(NRF_TWIM0, NRF_TWIS0, SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
419+
420+
extern "C"
421+
{
422+
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void)
423+
{
424+
Wire1.onService();
425+
}
426+
}
427+
#endif
428+
416429
#endif

0 commit comments

Comments
 (0)