From 3ad2fc30be8b200ada0ff1e2624e460e9898f5ae Mon Sep 17 00:00:00 2001 From: travisutk Date: Tue, 22 Feb 2011 20:22:47 +0000 Subject: [PATCH] GoodFETCCSPI.status() works, part of 'goodfet.ccspi info' git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@935 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETCCSPI.py | 16 +++++++++++++++- client/goodfet.ccspi | 5 +++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/client/GoodFETCCSPI.py b/client/GoodFETCCSPI.py index 612ce3e..411fcaa 100644 --- a/client/GoodFETCCSPI.py +++ b/client/GoodFETCCSPI.py @@ -91,8 +91,22 @@ class GoodFETCCSPI(GoodFET): def status(self): """Read the status byte.""" + statusbits={0x80: "?", + 0x40: "XOSC16M_STABLE", + 0x20: "TX_UNDERFLOW", + 0x10: "ENC_BUSY", + 0x08: "TX_ACTIVE", + 0x04: "LOCK", + 0x02: "RSSI_VALID", + 0x01: "?"}; status=self.strobe(0x00); - print "Status=%02x" % status; + i=1; + str=""; + while i<0x100: + if status&i: + str="%s %s" % (statusbits[i],str); + i*=2; + return str; #Radio stuff begins here. def RF_setenc(self,code="802.15.4"): diff --git a/client/goodfet.ccspi b/client/goodfet.ccspi index b2a33ee..a1facf0 100755 --- a/client/goodfet.ccspi +++ b/client/goodfet.ccspi @@ -44,8 +44,9 @@ client.setup(); #Might read as all ones if chip has a startup delay. if(sys.argv[1]=="info"): - print "Found %s" % client.identstr(); - print "Freq: %05.05f MHz" % (client.RF_getfreq()/(10**6)); + print "Found %s" % client.identstr(); + print "Freq: %05f MHz" % (client.RF_getfreq()/(10**6)); + print "Status: %s" % client.status(); if(sys.argv[1]=="regs"): for adr in range(0x10,0x40): #*1024): val=client.peek(adr); -- 2.20.1