Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6ca4422

Browse filesBrowse files
committed
I2CSlave: restore critical section with temp buffer
1 parent a9991f4 commit 6ca4422
Copy full SHA for 6ca4422

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎libraries/Wire/Wire.cpp

Copy file name to clipboardExpand all lines: libraries/Wire/Wire.cpp
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ void arduino::MbedI2C::receiveThd() {
158158
onRequestCb();
159159
}
160160
if (usedTxBuffer != 0) {
161-
slave->write((const char *) txBuffer, usedTxBuffer);
161+
core_util_critical_section_enter();
162+
uint8_t tempTxBuffer[usedTxBuffer];
163+
memcpy(tempTxBuffer, txBuffer, sizeof(tempTxBuffer));
162164
usedTxBuffer = 0;
165+
core_util_critical_section_exit();
166+
slave->write((const char *) tempTxBuffer, sizeof(tempTxBuffer));
163167
}
164168
//slave->stop();
165169
break;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.