Skip to content

Commit 99d1c9d

Browse files
committed
Wire: remove debug
1 parent a075fef commit 99d1c9d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

libraries/Wire/Wire.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ size_t arduino::ZephyrI2C::requestFrom(uint8_t address, size_t len,
4545
int ret = i2c_read(i2c_dev, rxRingBuffer.buffer, len, address);
4646
if (ret != 0)
4747
{
48-
printk("\n\nERR: i2c burst read fails\n\n\n");
4948
return 0;
5049
}
5150
ret = ring_buf_put(&rxRingBuffer.rb, rxRingBuffer.buffer, len);
5251
if (ret == 0)
5352
{
54-
printk("\n\nERR: buff put fails\n\n\n");
5553
return 0;
5654
}
5755
return len;
@@ -80,7 +78,6 @@ int arduino::ZephyrI2C::read() {
8078
if (ring_buf_peek(&rxRingBuffer.rb, buf, 1) > 0) {
8179
int ret = ring_buf_get(&rxRingBuffer.rb, buf, 1);
8280
if (ret == 0) {
83-
printk("\n\nERR: buff empty\n\n\n");
8481
return 0;
8582
}
8683
return (int)buf[0];
@@ -89,7 +86,7 @@ int arduino::ZephyrI2C::read() {
8986
}
9087

9188
int arduino::ZephyrI2C::available() { // TODO for ADS1115
92-
return !ring_buf_is_empty(&rxRingBuffer.rb); // ret 0 if empty
89+
return ring_buf_size_get(&rxRingBuffer.rb); // ret 0 if empty
9390
}
9491

9592
int arduino::ZephyrI2C::peek() {
@@ -121,7 +118,7 @@ DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), i2cs, DECLARE_WIRE_N)
121118
#undef DECL_WIRE_N
122119
#undef DECL_WIRE_0
123120
#undef ARDUINO_WIRE_DEFINED_0
124-
#else // PROP_LEN(i2cs) > 1
121+
#elif (DT_PROP_LEN(DT_PATH(zephyr_user), i2cs) == 1)
125122
/* When PROP_LEN(i2cs) == 1, DT_FOREACH_PROP_ELEM work not correctly. */
126123
arduino::ZephyrI2C Wire(DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), i2cs, 0)));
127124
#endif // HAS_PORP(i2cs)

0 commit comments

Comments
 (0)