Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino Core for SAMD21 CPU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
Arduino Core for SAMD21 CPU
Commits
1ce4a2f0
Commit
1ce4a2f0
authored
9 years ago
by
Cristian Maglie
Browse files
Options
Downloads
Patches
Plain Diff
Made multiple Wire instances fully configurable from variant
parent
45684715
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/Wire/Wire.cpp
+51
-14
51 additions, 14 deletions
libraries/Wire/Wire.cpp
with
51 additions
and
14 deletions
libraries/Wire/Wire.cpp
+
51
−
14
View file @
1ce4a2f0
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment