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
5c6890c6
Commit
5c6890c6
authored
9 years ago
by
Cristian Maglie
Browse files
Options
Downloads
Plain Diff
Merge branch 'wire-fixes' of
https://github.com/cmaglie/ArduinoCore-samd
parents
bf1f185f
024e089d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/Wire/Wire.cpp
+8
-19
8 additions, 19 deletions
libraries/Wire/Wire.cpp
with
8 additions
and
19 deletions
libraries/Wire/Wire.cpp
+
8
−
19
View file @
5c6890c6
...
...
@@ -68,22 +68,15 @@ uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit)
rxBuffer
.
store_char
(
sercom
->
readDataWIRE
());
// Connected to slave
//while(toRead--)
for
(
byteRead
=
0
;
byteRead
<
quantity
;
++
byteRead
)
for
(
byteRead
=
1
;
byteRead
<
quantity
;
++
byteRead
)
{
if
(
byteRead
==
quantity
-
1
)
// Stop transmission
{
sercom
->
prepareNackBitWIRE
();
// Prepare NACK to stop slave transmission
//sercom->readDataWIRE(); // Clear data register to send NACK
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_STOP
);
// Send Stop
}
else
// Continue transmission
{
sercom
->
prepareAckBitWIRE
();
// Prepare Acknowledge
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_READ
);
// Prepare the ACK command for the slave
rxBuffer
.
store_char
(
sercom
->
readDataWIRE
()
);
// Read data and send the ACK
}
sercom
->
prepareAckBitWIRE
();
// Prepare Acknowledge
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_READ
);
// Prepare the ACK command for the slave
rxBuffer
.
store_char
(
sercom
->
readDataWIRE
());
// Read data and send the ACK
}
sercom
->
prepareNackBitWIRE
();
// Prepare NACK to stop slave transmission
//sercom->readDataWIRE(); // Clear data register to send NACK
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_STOP
);
// Send Stop
}
return
byteRead
;
...
...
@@ -134,12 +127,8 @@ uint8_t TwoWire::endTransmission(bool stopBit)
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_STOP
);
return
3
;
// Nack or error
}
if
(
txBuffer
.
available
()
==
0
)
{
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_STOP
);
}
}
sercom
->
prepareCommandBitsWire
(
WIRE_MASTER_ACT_STOP
);
return
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