Skip to content
Snippets Groups Projects
Commit 1ce4a2f0 authored by Cristian Maglie's avatar Cristian Maglie
Browse files

Made multiple Wire instances fully configurable from variant

parent 45684715
No related branches found
No related tags found
No related merge requests found
......@@ -246,22 +246,59 @@ void TwoWire::onService(void)
}
#if WIRE_INTERFACES_COUNT > 0
/* In case new variant doesn't define these macros,
* we put here the ones for Arduino Zero.
*
* These values should be different on some variants!
*/
#ifndef PERIPH_WIRE
#define PERIPH_WIRE sercom3
#define WIRE_IT_HANDLER SERCOM3_Handler
#endif // PERIPH_WIRE
TwoWire Wire(&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL);
void WIRE_IT_HANDLER(void) {
Wire.onService();
}
#endif
/* In case new variant doesn't define these macros,
* we put here the ones for Arduino Zero.
*
* These values should be different on some variants!
*/
#if WIRE_INTERFACES_COUNT > 1
TwoWire Wire1(&PERIPH_WIRE1, PIN_WIRE1_SDA, PIN_WIRE1_SCL);
void WIRE1_IT_HANDLER(void) {
Wire1.onService();
}
#endif
#if WIRE_INTERFACES_COUNT > 2
TwoWire Wire2(&PERIPH_WIRE2, PIN_WIRE2_SDA, PIN_WIRE2_SCL);
#ifndef PERIPH_WIRE
# define PERIPH_WIRE sercom3
# define WIRE_IT_HANDLER SERCOM3_Handler
#endif // PERIPH_WIRE
void WIRE2_IT_HANDLER(void) {
Wire2.onService();
}
#endif
TwoWire Wire(&PERIPH_WIRE, PIN_WIRE_SDA, PIN_WIRE_SCL);
#if WIRE_INTERFACES_COUNT > 3
TwoWire Wire3(&PERIPH_WIRE3, PIN_WIRE3_SDA, PIN_WIRE3_SCL);
void WIRE_IT_HANDLER(void) {
Wire.onService();
}
void WIRE3_IT_HANDLER(void) {
Wire3.onService();
}
#endif
#if WIRE_INTERFACES_COUNT > 4
TwoWire Wire4(&PERIPH_WIRE4, PIN_WIRE4_SDA, PIN_WIRE4_SCL);
void WIRE4_IT_HANDLER(void) {
Wire4.onService();
}
#endif
#if WIRE_INTERFACES_COUNT > 5
TwoWire Wire5(&PERIPH_WIRE5, PIN_WIRE5_SDA, PIN_WIRE5_SCL);
void WIRE5_IT_HANDLER(void) {
Wire5.onService();
}
#endif
#endif // WIRE_INTERFACES_COUNT > 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment