@@ -45,13 +45,11 @@ size_t arduino::ZephyrI2C::requestFrom(uint8_t address, size_t len,
45
45
int ret = i2c_read (i2c_dev, rxRingBuffer.buffer , len, address);
46
46
if (ret != 0 )
47
47
{
48
- printk (" \n\n ERR: i2c burst read fails\n\n\n " );
49
48
return 0 ;
50
49
}
51
50
ret = ring_buf_put (&rxRingBuffer.rb , rxRingBuffer.buffer , len);
52
51
if (ret == 0 )
53
52
{
54
- printk (" \n\n ERR: buff put fails\n\n\n " );
55
53
return 0 ;
56
54
}
57
55
return len;
@@ -80,7 +78,6 @@ int arduino::ZephyrI2C::read() {
80
78
if (ring_buf_peek (&rxRingBuffer.rb , buf, 1 ) > 0 ) {
81
79
int ret = ring_buf_get (&rxRingBuffer.rb , buf, 1 );
82
80
if (ret == 0 ) {
83
- printk (" \n\n ERR: buff empty\n\n\n " );
84
81
return 0 ;
85
82
}
86
83
return (int )buf[0 ];
@@ -89,7 +86,7 @@ int arduino::ZephyrI2C::read() {
89
86
}
90
87
91
88
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
93
90
}
94
91
95
92
int arduino::ZephyrI2C::peek () {
@@ -121,7 +118,7 @@ DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), i2cs, DECLARE_WIRE_N)
121
118
#undef DECL_WIRE_N
122
119
#undef DECL_WIRE_0
123
120
#undef ARDUINO_WIRE_DEFINED_0
124
- #else // PROP_LEN( i2cs) > 1
121
+ #elif (DT_PROP_LEN(DT_PATH(zephyr_user), i2cs) == 1)
125
122
/* When PROP_LEN(i2cs) == 1, DT_FOREACH_PROP_ELEM work not correctly. */
126
123
arduino::ZephyrI2C Wire (DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), i2cs, 0)));
127
124
#endif // HAS_PORP(i2cs)
0 commit comments