Skip to content

Commit 743bd24

Browse files
authored
Merge pull request #22 from caternuson/iss12
Move consts out of class level
2 parents 107bf5c + 4821e9f commit 743bd24

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

adafruit_fram.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
_SPI_MANF_ID = const(0x04)
6161
_SPI_PROD_ID = const(0x302)
6262

63+
_SPI_OPCODE_WREN = const(0x6) # Set write enable latch
64+
_SPI_OPCODE_WRDI = const(0x4) # Reset write enable latch
65+
_SPI_OPCODE_RDSR = const(0x5) # Read status register
66+
_SPI_OPCODE_WRSR = const(0x1) # Write status register
67+
_SPI_OPCODE_READ = const(0x3) # Read memory code
68+
_SPI_OPCODE_WRITE = const(0x2) # Write memory code
69+
_SPI_OPCODE_RDID = const(0x9F) # Read device ID
70+
6371

6472
class FRAM:
6573
"""
@@ -282,12 +290,6 @@ def write_protected(self, value):
282290
self._wp_pin.value = value
283291

284292

285-
# the following pylint disables are related to the '_SPI_OPCODE' consts, the super
286-
# class setter '@FRAM.write_protected.setter', and pylint not being able to see
287-
# 'spi.write()' in SPIDevice. Travis run for reference:
288-
# https://travis-ci.com/sommersoft/Adafruit_CircuitPython_FRAM/builds/87112669
289-
290-
# pylint: disable=no-member,undefined-variable
291293
class FRAM_SPI(FRAM):
292294
""" SPI class for FRAM.
293295
@@ -301,14 +303,6 @@ class FRAM_SPI(FRAM):
301303
:param int max_size: Size of FRAM in Bytes. Default is ``8192``.
302304
"""
303305

304-
_SPI_OPCODE_WREN = const(0x6) # Set write enable latch
305-
_SPI_OPCODE_WRDI = const(0x4) # Reset write enable latch
306-
_SPI_OPCODE_RDSR = const(0x5) # Read status register
307-
_SPI_OPCODE_WRSR = const(0x1) # Write status register
308-
_SPI_OPCODE_READ = const(0x3) # Read memory code
309-
_SPI_OPCODE_WRITE = const(0x2) # Write memory code
310-
_SPI_OPCODE_RDID = const(0x9F) # Read device ID
311-
312306
# pylint: disable=too-many-arguments,too-many-locals
313307
def __init__(
314308
self,

0 commit comments

Comments
 (0)