Skip to content

Move consts out of class level #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions adafruit_fram.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
_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:
"""
Expand Down Expand Up @@ -282,12 +290,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.

Expand All @@ -301,14 +303,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,
Expand Down