2 # GoodFET SPI and SPIFlash Client Library
4 # (C) 2009 Travis Goodspeed <travis at radiantmachines.com>
6 # This code is being rewritten and refactored. You've been warned!
8 import sys, time, string, cStringIO, struct, glob, serial, os;
10 from GoodFET import GoodFET;
12 class GoodFETAVR(GoodFET):
16 """Move the FET into the SPI application."""
17 self.writecmd(self.AVRAPP,0x10,0,self.data); #SPI/SETUP
20 """Exchange data by AVR.
21 Input should probably be 4 bytes."""
23 self.writecmd(self.AVRAPP,0x00,len(data),data);
27 """Start the connection."""
28 self.writecmd(self.AVRAPP,0x20,0,None);
31 """Return an identifying string."""
32 self.writecmd(self.AVRAPP,0x83,0,None);
33 return "AVR(%02x)" % ord(self.data[0]);