| Line 237... |
Line 237... |
| 237 |
if size > 48 or size < 1:
|
237 |
if size > 48 or size < 1:
|
| 238 |
raise ArgumentError("Size must be a number between 1 and 48")
|
238 |
raise ArgumentError("Size must be a number between 1 and 48")
|
| 239 |
return self.lib.monitorcommand(struct.pack("<IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III", (None, None, None))
|
239 |
return self.lib.monitorcommand(struct.pack("<IBBBBII%ds" % size, 9, index, slaveaddr, startaddr, size, 0, 0, data), "III", (None, None, None))
|
| 240 |
|
240 |
|
| 241 |
@command()
|
241 |
@command()
|
| 242 |
def usbcread(self):
|
242 |
def usbcread(self, maxsize = 48):
|
| 243 |
""" Reads one packet with the maximal cin size from the console """
|
243 |
""" Reads one packet with the maximal cin size from the console """
|
| 244 |
cin_maxsize = 48
|
244 |
maxsize = min(0xff0, maxsize)
|
| 245 |
resp = self.lib.monitorcommand(struct.pack("<IIII", 10, cin_maxsize, 0, 0), "III%ds" % cin_maxsize, ("validsize", "buffersize", "queuesize", "data"))
|
245 |
resp = self.lib.monitorcommand(struct.pack("<IIII", 10, maxsize, 0, 0), "III%ds" % maxsize, ("validsize", "buffersize", "queuesize", "data"))
|
| 246 |
resp.data = resp.data[:resp.validsize].decode("latin_1")
|
246 |
resp.data = resp.data[:resp.validsize].decode("latin_1")
|
| 247 |
resp.maxsize = cin_maxsize
|
247 |
resp.maxsize = maxsize
|
| 248 |
return resp
|
248 |
return resp
|
| 249 |
|
249 |
|
| 250 |
@command()
|
250 |
@command()
|
| 251 |
def usbcwrite(self, data):
|
251 |
def usbcwrite(self, data):
|
| 252 |
""" Writes data to the USB console """
|
252 |
""" Writes data to the USB console """
|