From e8831b24680e4c5e120d8e92b8650fbd32237aab Mon Sep 17 00:00:00 2001 From: caternuson Date: Mon, 28 Sep 2020 15:14:31 -0700 Subject: [PATCH 1/2] move consts out of class --- adafruit_fram.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/adafruit_fram.py b/adafruit_fram.py index 8369e2a..3819404 100755 --- a/adafruit_fram.py +++ b/adafruit_fram.py @@ -60,6 +60,13 @@ _SPI_MANF_ID = const(0x04) _SPI_PROD_ID = const(0x302) +_SPI_OPCODE_WREN = const(0x6) # Set write enable latch +_SPI_OPCODE_WRDI = const(0x4) # Reset write enable latch +_SPI_OPCODE_RDSR = const(0x5) # Read status register +_SPI_OPCODE_WRSR = const(0x1) # Write status register +_SPI_OPCODE_READ = const(0x3) # Read memory code +_SPI_OPCODE_WRITE = const(0x2) # Write memory code +_SPI_OPCODE_RDID = const(0x9F) # Read device ID class FRAM: """ @@ -282,12 +289,6 @@ def write_protected(self, value): self._wp_pin.value = value -# the following pylint disables are related to the '_SPI_OPCODE' consts, the super -# class setter '@FRAM.write_protected.setter', and pylint not being able to see -# 'spi.write()' in SPIDevice. Travis run for reference: -# https://travis-ci.com/sommersoft/Adafruit_CircuitPython_FRAM/builds/87112669 - -# pylint: disable=no-member,undefined-variable class FRAM_SPI(FRAM): """ SPI class for FRAM. @@ -301,14 +302,6 @@ class FRAM_SPI(FRAM): :param int max_size: Size of FRAM in Bytes. Default is ``8192``. """ - _SPI_OPCODE_WREN = const(0x6) # Set write enable latch - _SPI_OPCODE_WRDI = const(0x4) # Reset write enable latch - _SPI_OPCODE_RDSR = const(0x5) # Read status register - _SPI_OPCODE_WRSR = const(0x1) # Write status register - _SPI_OPCODE_READ = const(0x3) # Read memory code - _SPI_OPCODE_WRITE = const(0x2) # Write memory code - _SPI_OPCODE_RDID = const(0x9F) # Read device ID - # pylint: disable=too-many-arguments,too-many-locals def __init__( self, From 4821e9fac196bb7dd41ecde79d4066f451aaa553 Mon Sep 17 00:00:00 2001 From: caternuson Date: Mon, 28 Sep 2020 15:24:29 -0700 Subject: [PATCH 2/2] black --- adafruit_fram.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_fram.py b/adafruit_fram.py index 3819404..2d71ce7 100755 --- a/adafruit_fram.py +++ b/adafruit_fram.py @@ -68,6 +68,7 @@ _SPI_OPCODE_WRITE = const(0x2) # Write memory code _SPI_OPCODE_RDID = const(0x9F) # Read device ID + class FRAM: """ Driver base for the FRAM Breakout.