41
41
__version__ = "0.0.0-auto.0"
42
42
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C.git"
43
43
44
-
45
44
class DebugI2C :
46
45
"""
47
46
Wrapper library for debugging I2C.
@@ -107,7 +106,9 @@ def readfrom_into(self, address, buffer, *args, start=0, end=None):
107
106
108
107
"""
109
108
self ._i2c .readfrom_into (address , buffer , * args , start = start , end = end )
110
- print ("i2c.readfrom_into at address {}:" .format (hex (address )), [hex (i ) for i in buffer ])
109
+
110
+ in_buffer_str = ", " .join ([hex (i ) for i in buffer ])
111
+ print ("\t I2CREAD @ {} ::" .format (hex (address )), in_buffer_str )
111
112
112
113
def scan (self ):
113
114
"""
@@ -146,7 +147,9 @@ def writeto(self, address, buffer, *args, **kwargs):
146
147
buffer is written
147
148
"""
148
149
self ._i2c .writeto (address , buffer , * args , ** kwargs )
149
- print ("i2c.writeto at address {}:" .format (hex (address )), [hex (i ) for i in buffer ])
150
+
151
+ out_buffer_str = ", " .join ([hex (i ) for i in buffer ])
152
+ print ("\t I2CWRITE @ {} ::" .format (hex (address )), out_buffer_str )
150
153
151
154
def _writeto_then_readfrom (self , address , buffer_out , buffer_in , * args , out_start = 0 ,
152
155
out_end = None , in_start = 0 , in_end = None ):
@@ -167,9 +170,11 @@ def _writeto_then_readfrom(self, address, buffer_out, buffer_in, *args, out_star
167
170
:param int in_end: End of the slice; this index is not included. Defaults to
168
171
``len(buffer_in)``
169
172
"""
170
- print ("i2c.writeto_then_readfrom.buffer_out at address {}:" .format (hex (address )),
171
- [hex (i ) for i in buffer_out [out_start :out_end ]])
173
+ out_buffer_str = ", " .join ([hex (i ) for i in buffer_out [out_start :out_end ]])
174
+ print ("\t I2CWRITE @ {} ::" .format (hex (address )), out_buffer_str )
175
+
172
176
self ._i2c .writeto_then_readfrom (address , buffer_out , buffer_in , * args , out_start = out_start ,
173
177
out_end = out_end , in_start = in_start , in_end = in_end )
174
- print ("i2c.writeto_then_readfrom.buffer_in at address {}:" .format (hex (address )),
175
- [hex (i ) for i in buffer_in [in_start :in_end ]])
178
+
179
+ in_buffer_str = ", " .join ([hex (i ) for i in buffer_in [in_start :in_end ]])
180
+ print ("\t I2CREAD @ {} ::" .format (hex (address )), in_buffer_str )
0 commit comments