MrDraw/SkeinPyPy_NewUI/avr_isp/ispBase.py
Daid d3af800217 Large update adding:
-Python based firmware loader (not used yet)
-Beginning of the first run wizard
-Preferences window
Also moved around a few functions, cleaned somethings up
2012-03-05 22:30:54 +01:00

38 lines
967 B
Python

import os, struct, sys, time
from serial import Serial
import chipDB
class IspBase():
def programChip(self, flashData):
self.curExtAddr = -1
self.chip = chipDB.getChipFromDB(self.getSignature())
if self.chip == False:
print "Chip with signature: " + str(self.getSignature()) + "not found"
return False
self.chipErase()
print "Flashing %i bytes" % len(flashData)
self.writeFlash(flashData)
print "Verifying %i bytes" % len(flashData)
self.verifyFlash(flashData)
return True
#low level ISP commands
def getSignature(self):
sig = []
sig.append(self.sendISP([0x30, 0x00, 0x00, 0x00])[3])
sig.append(self.sendISP([0x30, 0x00, 0x01, 0x00])[3])
sig.append(self.sendISP([0x30, 0x00, 0x02, 0x00])[3])
return sig
def chipErase(self):
self.sendISP([0xAC, 0x80, 0x00, 0x00])
class IspError():
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)