X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETNRF.py;h=e9c44c19a37ad6d776e61ee1bfc131dc16f3a511;hp=459b71f253566b634e68bf0544d31976f3857748;hb=1ffbcb9d3d58e2363677546f6b5d8376b2766f41;hpb=66f8e67c8c72eccb60a7a772364ec83a53680aac diff --git a/client/GoodFETNRF.py b/client/GoodFETNRF.py index 459b71f..e9c44c1 100644 --- a/client/GoodFETNRF.py +++ b/client/GoodFETNRF.py @@ -50,15 +50,22 @@ class GoodFETNRF(GoodFET): print "Status=%02x" % status; #Radio stuff begins here. - def RF_freq(self,frequency): + def RF_setfreq(self,frequency): """Set the frequency in Hz.""" #On the NRF24L01+, register 0x05 is the offset in #MHz above 2400. - mhz=frequency/1000000-2400; - print "Setting channel %i." % mhz - self.poke(0x05,mhz); + chan=frequency/1000000-2400; + self.poke(0x05,chan); + def RF_getfreq(self): + """Get the frequency in Hz.""" + + #On the NRF24L01+, register 0x05 is the offset in + #MHz above 2400. + + return (2400+self.peek(0x05))*10**6 + self.poke(0x05,chan); def RF_getsmac(self): """Return the source MAC address.""" @@ -100,3 +107,4 @@ class GoodFETNRF(GoodFET): """Set the number of bytes in the expected payload.""" self.poke(0x11,len); self.packetlen=len; +