Skip to content

Commit 142f272

Browse files
authored
Merge pull request #1061 from pennam/i2c-slave-fix-3
Wire: I2CSlave: move out slave->read from critical section
2 parents 376aabf + e38653a commit 142f272

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/Wire/Wire.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ void arduino::MbedI2C::receiveThd() {
170170
break;
171171
case mbed::I2CSlave::WriteGeneral:
172172
case mbed::I2CSlave::WriteAddressed:
173-
core_util_critical_section_enter();
174-
rxBuffer.clear();
175173
char buf[240];
176174
c = slave->read(buf, sizeof(buf));
175+
core_util_critical_section_enter();
176+
rxBuffer.clear();
177177
for (buf_idx = 0; buf_idx < c; buf_idx++) {
178178
if (rxBuffer.availableForStore()) {
179179
rxBuffer.store_char(uint8_t(buf[buf_idx]));

0 commit comments

Comments
 (0)