hz=freq*396.728515625;
return hz;
+ lastshellcode="none";
def shellcodefile(self,filename,wait=1):
"""Run a fragment of shellcode by name."""
#FIXME: should identify chip model number, use shellcode for that chip.
- file=__file__;
- file=file.replace("GoodFETCC.pyc","GoodFETCC.py");
- path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/");
- #print "File\t%s" % file;
- #print "Path\t%s" % path;
- filename=path+filename;
- #print "Loading shelcode from %s" % filename;
-
- #Load the shellcode.
- h=IntelHex(filename);
- for i in h._buf.keys():
- self.CCpokedatabyte(i,h[i]);
+
+ if self.lastshellcode!=filename:
+ self.lastshellcode=filename;
+ file=__file__;
+ file=file.replace("GoodFETCC.pyc","GoodFETCC.py");
+ path=file.replace("client/GoodFETCC.py","shellcode/chipcon/cc1110/");
+ filename=path+filename;
+
+ #Load the shellcode.
+ h=IntelHex(filename);
+ for i in h._buf.keys():
+ self.CCpokedatabyte(i,h[i]);
#Execute it.
self.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000
port=packet[9];
info=packet[10];
seq=packet[11];
- #payload begins at byte 12.
+ #payload begins at byte 10.
-
- if port==0x03:
+ if port==0x20:
+ #data packet
+ x=packet[11];
+ y=packet[13];
+ z=packet[15];
+ print "%02x: %i %i %i" % (seq,x,y,z);
+ elif port==0x03:
#print "Join request.";
if packet[12]!=1:
print "Not a join request. WTF?";
rssi=0;
rssi=client.peek8(0xFE00,"xdata");
print "Activated jamming with RSSI of %i, going again for another packet." % rssi;
+ #client.CCdebuginstr([0x02, 0xf0, 0x00]); #ljmp 0xF000
client.resume();
RFST=0xDFE1
RFTXRXIE=0;
//idle a bit.
- RFST=RFST_SIDLE;
- while(MARCSTATE!=MARC_STATE_IDLE);
+ //RFST=RFST_SIDLE;
+ //while(MARCSTATE!=MARC_STATE_IDLE);
while(1){
//Wait for the transmission.
RFST=RFST_SRX;
+ while(MARCSTATE!=MARC_STATE_RX);
rssi=0;
//Wait for RSSI to settle.
sleepMillis(10);
RFTXRXIE=0;
//idle a bit.
- RFST=RFST_SIDLE;
- while(MARCSTATE!=MARC_STATE_IDLE);
+ //RFST=RFST_SIDLE;
+ //while(MARCSTATE!=MARC_STATE_IDLE);
//Begin to receive.
RFST=RFST_SRX;
while(!RFTXRXIF); //Wait for byte to be ready.
RFTXRXIF=0; //Clear the flag.
- if (MARCSTATE == MARC_STATE_RX) {
- packet[i]=RFD; //Grab the next byte.
- i++;
- len=packet[0]; //First byte of the packet is the length.
- }else
- HALT;
-
+ packet[i]=RFD; //Grab the next byte.
+ i++;
+ len=packet[0]; //First byte of the packet is the length.
}
RFST = RFST_SIDLE; //End receive.
HALT;