We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9ebf8ba commit 939a22dCopy full SHA for 939a22d
1 file changed
libraries/Wire/Wire.cpp
@@ -98,10 +98,10 @@ int arduino::ZephyrI2C::available() { // TODO for ADS1115
98
99
int arduino::ZephyrI2C::peek() {
100
uint8_t buf[1];
101
- int bytes_read = ring_buf_peek(&rxRingBuffer.rb, buf, 1);
102
- if (bytes_read == 0){
103
- return 0;
104
- }
+ if (!ring_buf_peek(&rxRingBuffer.rb, buf, 1)){
+ // No data available
+ return -1;
+ }
105
return (int)buf[0];
106
}
107
0 commit comments