File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ void TwoWire::onService(void)
220220 if ( sercom->isSlaveWIRE () )
221221 {
222222 if (sercom->isStopDetectedWIRE () ||
223- (sercom->isAddressMatch () && sercom->isRestartDetectedWIRE ())) // Stop or Restart detected
223+ (sercom->isAddressMatch () && sercom->isRestartDetectedWIRE () && !sercom-> isMasterReadOperationWIRE () )) // Stop or Restart detected
224224 {
225225 sercom->prepareAckBitWIRE ();
226226 sercom->prepareCommandBitsWire (0x03 );
@@ -240,6 +240,10 @@ void TwoWire::onService(void)
240240
241241 if (sercom->isMasterReadOperationWIRE ()) // Is a request ?
242242 {
243+ // wait for data ready flag,
244+ // before calling request callback
245+ while (!sercom->isDataReadyWIRE ());
246+
243247 // Calling onRequestCallback, if exists
244248 if (onRequestCallback)
245249 {
You can’t perform that action at this time.
0 commit comments