From 14d054a561a9e21ad8559dfde62be3bc2c752f97 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 14 Oct 2013 21:49:19 +0200 Subject: Microchip: Clear sig and eeprom support flags on chips that don't support them Signed-off-by: Michael Buesch --- libtoprammer/chip.py | 2 +- libtoprammer/chips/microchip8/microchip8_common.py | 12 ++++++++++++ libtoprammer/chips/microchip8/microchip8_singlePMarea.py | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libtoprammer/chip.py b/libtoprammer/chip.py index 7fa9ba8..e564daa 100644 --- a/libtoprammer/chip.py +++ b/libtoprammer/chip.py @@ -27,7 +27,7 @@ from generic_algorithms import * from ihex import * -class Chip: +class Chip(object): SUPPORT_ERASE = (1 << 0) SUPPORT_SIGREAD = (1 << 1) SUPPORT_PROGMEMREAD = (1 << 2) diff --git a/libtoprammer/chips/microchip8/microchip8_common.py b/libtoprammer/chips/microchip8/microchip8_common.py index ec0be85..f849895 100644 --- a/libtoprammer/chips/microchip8/microchip8_common.py +++ b/libtoprammer/chips/microchip8/microchip8_common.py @@ -41,6 +41,8 @@ class Chip_Microchip8_common(Chip): # EEPROM access: default off, if exists override it hasEEPROM = False + # Signature bytes access: default on, if doesn't exist, override it + hasSigBytes = True # default delays - can be overridden delayTdly5 = 0.00000015 @@ -49,6 +51,16 @@ class Chip_Microchip8_common(Chip): delayTdly = 0.000001 delayTera = 0.01 + @classmethod + def getSupportFlags(cls): + flags = super(Chip_Microchip8_common, cls).getSupportFlags() + if not cls.hasEEPROM: + flags &= ~(Chip.SUPPORT_EEPROMREAD |\ + Chip.SUPPORT_EEPROMWRITE) + if not cls.hasSigBytes: + flags &= ~Chip.SUPPORT_SIGREAD + return flags + def __init__(self, chipPackage, chipPinVCC, chipPinsVPP, chipPinGND, signature, diff --git a/libtoprammer/chips/microchip8/microchip8_singlePMarea.py b/libtoprammer/chips/microchip8/microchip8_singlePMarea.py index 8eea33b..a3bacb7 100644 --- a/libtoprammer/chips/microchip8/microchip8_singlePMarea.py +++ b/libtoprammer/chips/microchip8/microchip8_singlePMarea.py @@ -27,6 +27,7 @@ class microchip8_singlePMarea(Chip_Microchip8_common): CMD_END_PROGRAMMING = 0x0E userIDLocationSize = 4 + hasSigBytes = False voltageVDD = 5 voltageVPP = 13 -- cgit v1.2.3