Standardizing Chipcon interface, bringing it into line with the NRF code.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 7 Dec 2010 01:26:30 +0000 (01:26 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 7 Dec 2010 01:26:30 +0000 (01:26 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@765 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFETCC.py
client/GoodFETNRF.py
client/goodfet.cc
client/goodfet.rf

index 9ebd87b..688219d 100644 (file)
@@ -76,6 +76,38 @@ class GoodFETCC(GoodFET):
                     print "%-10s=0x%02x; /* %-50s */" % (
                         name,self.CCpeekdatabyte(eval(address)), description);
                     if bitfields!="": print bitfields.rstrip();
                     print "%-10s=0x%02x; /* %-50s */" % (
                         name,self.CCpeekdatabyte(eval(address)), description);
                     if bitfields!="": print bitfields.rstrip();
+    def RF_setfreq(self,frequency):
+        """Set the frequency in Hz."""
+        #FIXME CC1110 specific
+        
+        hz=frequency;
+        freq=hz/396.728515625;
+        freq0=freq&0xFF;
+        freq1=(freq&0xFF00)>>8;
+        freq1=(freq&0xFF0000)>>16;
+        self.CCpokedatabyte(0xdf09,freq2);
+        self.CCpokedatabyte(0xdf09,freq1);
+        self.CCpokedatabyte(0xdf09,freq0);
+
+    def RF_getfreq(self):
+        """Get the frequency in Hz."""
+        #FIXME CC1110 specific
+        
+        #return (2400+self.peek(0x05))*10**6
+        #self.poke(0x05,chan);
+        freq2=self.CCpeekdatabyte(0xdf09);
+        freq1=self.CCpeekdatabyte(0xdf0a);
+        freq0=self.CCpeekdatabyte(0xdf0b);
+        freq=(freq2<<16)+(freq1<<8)+freq0;
+        hz=freq*396.728515625;
+        
+        return hz;
+    
+    def RF_carrier(self):
+        """Hold a carrier wave on the present frequency."""
+        # Set CONT_WAVE, PLL_LOCK, and 0dBm in RF_SETUP            
+        self.poke(0x06,8+10+4+2); 
+    
     def RF_getrssi(self):
         """Returns the received signal strenght, from 0 to 1."""
         rssireg=self.symbols.get("RSSI");
     def RF_getrssi(self):
         """Returns the received signal strenght, from 0 to 1."""
         rssireg=self.symbols.get("RSSI");
index e95b9cf..3c780a5 100644 (file)
@@ -164,7 +164,7 @@ class GoodFETNRF(GoodFET):
         """Hold a carrier wave on the present frequency."""
         # Set CONT_WAVE, PLL_LOCK, and 0dBm in RF_SETUP            
         self.poke(0x06,8+10+4+2); 
         """Hold a carrier wave on the present frequency."""
         # Set CONT_WAVE, PLL_LOCK, and 0dBm in RF_SETUP            
         self.poke(0x06,8+10+4+2); 
-        
+    
     packetlen=16;
     def RF_setpacketlen(self,len=16):
         """Set the number of bytes in the expected payload."""
     packetlen=16;
     def RF_setpacketlen(self,len=16):
         """Set the number of bytes in the expected payload."""
index bd28f4b..f5e46b5 100755 (executable)
@@ -19,7 +19,7 @@ if(len(sys.argv)==1):
     print "%s test" % sys.argv[0];
     print "%s term" % sys.argv[0];
     print "%s info" % sys.argv[0];
     print "%s test" % sys.argv[0];
     print "%s term" % sys.argv[0];
     print "%s info" % sys.argv[0];
-    print "%s radioinfo" % sys.argv[0];
+    print "%s regs" % sys.argv[0];
     print "%s dumpcode $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s dumpdata $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s writedata $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s dumpcode $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s dumpdata $foo.hex [0x$start 0x$stop]" % sys.argv[0];
     print "%s writedata $foo.hex [0x$start 0x$stop]" % sys.argv[0];
@@ -97,9 +97,16 @@ if(sys.argv[1]=="dumpdata"):
 if(sys.argv[1]=="status"):
     print "Status: %s" %client.status();
 if(sys.argv[1]=="info"):
 if(sys.argv[1]=="status"):
     print "Status: %s" %client.status();
 if(sys.argv[1]=="info"):
-    print "%s" % client.CCidentstr();
-if(sys.argv[1]=="radioinfo"):
+    print "Ident   %s" % client.CCidentstr();
+    print "Freq    %10.3f MHz" % (client.RF_getfreq()/10**6);
+    #print "Rate    %10i kbps" % (client.RF_getrate()/1000);
+    #print "PacketLen %02i bytes" % client.RF_getpacketlen();
+    #print "SMAC  0x%010x" % client.RF_getsmac();
+    #print "TMAC  0x%010x" % client.RF_gettmac();
+
+if(sys.argv[1]=="regs"):
     client.CMDrs();
     client.CMDrs();
+
 if(sys.argv[1]=="erase"):
     print "Status: %s" % client.status();
     client.CCchiperase();
 if(sys.argv[1]=="erase"):
     print "Status: %s" % client.status();
     client.CCchiperase();
index 525c1fa..eefc0e1 100755 (executable)
@@ -30,13 +30,21 @@ client.start();
 
 
 
 
 
 
+verb=sys.argv[2];
 
 
-
-if sys.argv[2]=='test':
+if verb=='test':
    client.test();
    client.test();
-if sys.argv[2]=='rssi':
+if verb=='rssi':
    rssireg=client.getrssi();
    rssireg=client.getrssi();
-   print "RSSI=%04x" % rssireg;
+   print "RSSI of %04x" % rssireg;
+if(verb=="carrier"):
+    if len(sys.argv)>2:
+        client.RF_setfreq(eval(sys.argv[3]));
+    client.RF_carrier();
+    print "\nHolding a carrier wave.";
+    while(1):
+        time.sleep(1);
+
 client.stop();
 
 
 client.stop();