We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9991f4 commit 6ca4422Copy full SHA for 6ca4422
libraries/Wire/Wire.cpp
@@ -158,8 +158,12 @@ void arduino::MbedI2C::receiveThd() {
158
onRequestCb();
159
}
160
if (usedTxBuffer != 0) {
161
- slave->write((const char *) txBuffer, usedTxBuffer);
+ core_util_critical_section_enter();
162
+ uint8_t tempTxBuffer[usedTxBuffer];
163
+ memcpy(tempTxBuffer, txBuffer, sizeof(tempTxBuffer));
164
usedTxBuffer = 0;
165
+ core_util_critical_section_exit();
166
+ slave->write((const char *) tempTxBuffer, sizeof(tempTxBuffer));
167
168
//slave->stop();
169
break;
0 commit comments