File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ void arduino::MbedI2C::receiveThd() {
153
153
int i = slave->receive ();
154
154
int c = 0 ;
155
155
int buf_idx = 0 ;
156
+ int available = 0 ;
156
157
switch (i) {
157
158
case mbed::I2CSlave::ReadAddressed:
158
159
if (onRequestCb != NULL ) {
@@ -179,11 +180,10 @@ void arduino::MbedI2C::receiveThd() {
179
180
break ;
180
181
}
181
182
}
182
- if (rxBuffer.available () > 0 && onReceiveCb != NULL ) {
183
- core_util_critical_section_exit ();
184
- onReceiveCb (rxBuffer.available ());
185
- } else {
186
- core_util_critical_section_exit ();
183
+ available = rxBuffer.available ();
184
+ core_util_critical_section_exit ();
185
+ if (available > 0 && onReceiveCb != NULL ) {
186
+ onReceiveCb (available);
187
187
}
188
188
// slave->stop();
189
189
break ;
You can’t perform that action at this time.
0 commit comments