From 9e36eb078bc4629f7dc311adc0f0613daf03fbe6 Mon Sep 17 00:00:00 2001 From: Watershade Zhang Date: Wed, 15 Nov 2023 14:53:05 +0800 Subject: [PATCH] Update Wire.cpp flush function have been never be implemented. But it is very useful. So I addvice to implement it. Thanks. --- libraries/Wire/Wire.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index 38c6f7e91..003a2897c 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -136,6 +136,7 @@ int arduino::MbedI2C::peek() { } void arduino::MbedI2C::flush() { + rxBuffer.clear(); } #ifdef DEVICE_I2CSLAVE @@ -197,4 +198,4 @@ arduino::MbedI2C Wire1(I2C_SDA1, I2C_SCL1); #endif #if WIRE_HOWMANY > 2 arduino::MbedI2C Wire2(I2C_SDA2, I2C_SCL2); -#endif \ No newline at end of file +#endif