@@ -246,22 +246,59 @@ void TwoWire::onService(void)
246246}
247247
248248#if WIRE_INTERFACES_COUNT > 0
249+ /* In case new variant doesn't define these macros,
250+ * we put here the ones for Arduino Zero.
251+ *
252+ * These values should be different on some variants!
253+ */
254+ #ifndef PERIPH_WIRE
255+ #define PERIPH_WIRE sercom3
256+ #define WIRE_IT_HANDLER SERCOM3_Handler
257+ #endif // PERIPH_WIRE
258+ TwoWire Wire (&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL);
259+
260+ void WIRE_IT_HANDLER (void ) {
261+ Wire.onService ();
262+ }
263+ #endif
249264
250- /* In case new variant doesn't define these macros,
251- * we put here the ones for Arduino Zero.
252- *
253- * These values should be different on some variants!
254- */
265+ #if WIRE_INTERFACES_COUNT > 1
266+ TwoWire Wire1 (&PERIPH_WIRE1, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
267+
268+ void WIRE1_IT_HANDLER (void ) {
269+ Wire1.onService ();
270+ }
271+ #endif
272+
273+ #if WIRE_INTERFACES_COUNT > 2
274+ TwoWire Wire2 (&PERIPH_WIRE2, PIN_WIRE2_SDA, PIN_WIRE2_SCL);
255275
256- # ifndef PERIPH_WIRE
257- # define PERIPH_WIRE sercom3
258- # define WIRE_IT_HANDLER SERCOM3_Handler
259- #endif // PERIPH_WIRE
276+ void WIRE2_IT_HANDLER ( void ) {
277+ Wire2. onService ();
278+ }
279+ #endif
260280
261- TwoWire Wire (&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL);
281+ #if WIRE_INTERFACES_COUNT > 3
282+ TwoWire Wire3 (&PERIPH_WIRE3, PIN_WIRE3_SDA, PIN_WIRE3_SCL);
262283
263- void WIRE_IT_HANDLER (void ) {
264- Wire.onService ();
265- }
284+ void WIRE3_IT_HANDLER (void ) {
285+ Wire3.onService ();
286+ }
287+ #endif
288+
289+ #if WIRE_INTERFACES_COUNT > 4
290+ TwoWire Wire4 (&PERIPH_WIRE4, PIN_WIRE4_SDA, PIN_WIRE4_SCL);
291+
292+ void WIRE4_IT_HANDLER (void ) {
293+ Wire4.onService ();
294+ }
295+ #endif
296+
297+ #if WIRE_INTERFACES_COUNT > 5
298+ TwoWire Wire5 (&PERIPH_WIRE5, PIN_WIRE5_SDA, PIN_WIRE5_SCL);
299+
300+ void WIRE5_IT_HANDLER (void ) {
301+ Wire5.onService ();
302+ }
303+ #endif
266304
267- #endif // WIRE_INTERFACES_COUNT > 0
0 commit comments