Removed unnecessary register prints in RF_promiscuity of CCSPI.
[goodfet] / client / GoodFETCCSPI.py
index 1d27c24..8172422 100644 (file)
@@ -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"):
@@ -141,7 +155,7 @@ class GoodFETCCSPI(GoodFET):
         """
         
         # TODO -- Flush only if there's an overflow.
-        self.strobe(0x08); #SFLUSHRX
+        #self.strobe(0x08); #SFLUSHRX
         
         data="\0";
         self.data=data;
@@ -180,9 +194,9 @@ class GoodFETCCSPI(GoodFET):
         print "Don't know how to hold a carrier.";
     def RF_promiscuity(self,promiscuous=1):
         mdmctrl0=self.peek(0x11);
-        print "mdmctrl0 was %04x" % mdmctrl0;
+        #print "mdmctrl0 was %04x" % mdmctrl0;
         mdmctrl0=mdmctrl0&(~0x800);
-        print "mdmctrl0 is now %04x" % mdmctrl0;
+        #print "mdmctrl0 is now %04x" % mdmctrl0;
         self.poke(0x11,mdmctrl0);
         return;