From: travisutk Date: Tue, 7 Dec 2010 20:45:55 +0000 (+0000) Subject: Closer to a self contained carrier wave. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=b6f18d95c8f6effd98cad31e74de8a23a86fea29 Closer to a self contained carrier wave. You should have seen how ugly the last hack to do this was. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@770 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFET.py b/client/GoodFET.py index 97e7996..4c6e3ed 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -377,7 +377,7 @@ class GoodFET: #TODO include memory in symbol. reg=self.symbols.get(name); return self.peek8(reg,"data"); - def pokebysim(self,name,val): + def pokebysym(self,name,val): """Write a value by its symbol name.""" #TODO include memory in symbol. reg=self.symbols.get(name); diff --git a/client/GoodFETCC.py b/client/GoodFETCC.py index 2d69fbf..b983f4c 100644 --- a/client/GoodFETCC.py +++ b/client/GoodFETCC.py @@ -11,7 +11,7 @@ import binascii; from GoodFET import GoodFET; from intelhex import IntelHex; -import xml.dom.minidom; +import xml.dom.minidom, time; class GoodFETCC(GoodFET): """A GoodFET variant for use with Chipcon 8051 Zigbee SoC.""" @@ -87,9 +87,9 @@ class GoodFETCC(GoodFET): freq1=(freq&0xFF00)>>8; freq2=(freq&0xFF0000)>>16; - self.pokebysim("FREQ2",freq2); - self.pokebysim("FREQ1",freq1); - self.pokebysim("FREQ0",freq0); + self.pokebysym("FREQ2",freq2); + self.pokebysym("FREQ1",freq1); + self.pokebysym("FREQ0",freq0); def RF_getfreq(self): @@ -117,8 +117,23 @@ class GoodFETCC(GoodFET): def RF_carrier(self): """Hold a carrier wave on the present frequency.""" - print "ERROR, this ain't working yet." - + self.pokebysym("SYNC1",0xAA); + self.pokebysym("SYNC0",0xAA); + + #Put radio in TX + self.pokebyte(0xdfe1,0x03); #RFST=RFST_STX + + print "Holding a carrier on %f MHz." % (self.RF_getfreq()/10**6); + + #while ((MARCSTATE & MARCSTATE_MARC_STATE) != MARC_STATE_TX); + state=0; + while( (state!=0x13)): + time.sleep(0.1); + state=self.peekbysym("MARCSTATE")&0x1F; + print "state=%02x" % state; + return; + + def RF_getrssi(self): """Returns the received signal strenght, with a weird offset.""" try: @@ -334,7 +349,8 @@ class GoodFETCC(GoodFET): self.data=[adr&0xff, val&0xff]; self.writecmd(self.APP,0x02, 2, self.data); return ord(self.data[0]); - + def pokebyte(self,adr,val,mem="data"): + self.CCpokedatabyte(adr,val); def CCpokedatabyte(self,adr,val): """Write a byte to data memory.""" self.data=[adr&0xff, (adr&0xff00)>>8, val];