px_uploader: print chip version

This commit is contained in:
Andrew Tridgell 2015-03-05 22:00:40 +11:00 committed by Lorenz Meier
parent d9b4f5b170
commit 332d42b105
1 changed files with 10 additions and 1 deletions

View File

@ -160,6 +160,7 @@ class uploader(object):
GET_CRC = b'\x29' # rev3+
GET_OTP = b'\x2a' # rev4+ , get a word from OTP area
GET_SN = b'\x2b' # rev4+ , get a word from SN area
GET_CHIP = b'\x2c' # rev5+ , get chip version
REBOOT = b'\x30'
INFO_BL_REV = b'\x01' # bootloader protocol revision
@ -258,7 +259,7 @@ class uploader(object):
self.__getSync()
return value
# send the GET_OTP command and wait for an info parameter
# send the GET_SN command and wait for an info parameter
def __getSN(self, param):
t = struct.pack("I", param) # int param as 32bit ( 4 byte ) char array.
self.__send(uploader.GET_SN + t + uploader.EOC)
@ -266,6 +267,13 @@ class uploader(object):
self.__getSync()
return value
# send the GET_CHIP command
def __getCHIP(self):
self.__send(uploader.GET_CHIP + uploader.EOC)
value = self.__recv_int()
self.__getSync()
return value
def __drawProgressBar(self, label, progress, maxVal):
if maxVal < progress:
progress = maxVal
@ -451,6 +459,7 @@ class uploader(object):
self.sn = self.sn + x
print(binascii.hexlify(x).decode('Latin-1'), end='') # show user
print('')
print("chip: %08x" % self.__getCHIP())
except Exception:
# ignore bad character encodings
pass