GoodFETCCSPI.status() works, part of 'goodfet.ccspi info'
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 22 Feb 2011 20:22:47 +0000 (20:22 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 22 Feb 2011 20:22:47 +0000 (20:22 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@935 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETCCSPI.py
client/goodfet.ccspi

index 612ce3e..411fcaa 100644 (file)
@@ -91,8 +91,22 @@ class GoodFETCCSPI(GoodFET):
     
     def status(self):
         """Read the status byte."""
     
     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);
         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"):
     
     #Radio stuff begins here.
     def RF_setenc(self,code="802.15.4"):
index b2a33ee..a1facf0 100755 (executable)
@@ -44,8 +44,9 @@ client.setup();
 #Might read as all ones if chip has a startup delay.
 
 if(sys.argv[1]=="info"):
 #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);
 if(sys.argv[1]=="regs"):
     for adr in range(0x10,0x40): #*1024):
         val=client.peek(adr);