Skip to content

Ran black, updated to pylint 2.x #73

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 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
source actions-ci/install.sh
- name: Pip install pylint, black, & Sphinx
run: |
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
- name: Library version
run: git describe --dirty --always --tags
- name: PyLint
Expand Down
17 changes: 9 additions & 8 deletions adafruit_rgb_display/hx8353.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@
_INVON = const(0x21)
_DISPOFF = const(0x28)
_DISPON = const(0x29)
_CASET = const(0x2a)
_PASET = const(0x2b)
_RAMWR = const(0x2c)
_RAMRD = const(0x2e)
_CASET = const(0x2A)
_PASET = const(0x2B)
_RAMWR = const(0x2C)
_RAMRD = const(0x2E)
_MADCTL = const(0x36)
_COLMOD = const(0x3a)
_COLMOD = const(0x3A)


class HX8353(DisplaySPI):
"""
Expand All @@ -62,6 +63,7 @@ class HX8353(DisplaySPI):
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)
"""

_COLUMN_SET = _CASET
_PAGE_SET = _PASET
_RAM_WRITE = _RAMWR
Expand All @@ -73,7 +75,6 @@ class HX8353(DisplaySPI):
_ENCODE_PIXEL = ">H"
_ENCODE_POS = ">HH"

#pylint: disable-msg=useless-super-delegation, too-many-arguments
def __init__(self, spi, dc, cs, rst=None, width=128, height=128,
rotation=0):
# pylint: disable-msg=useless-super-delegation, too-many-arguments
def __init__(self, spi, dc, cs, rst=None, width=128, height=128, rotation=0):
super().__init__(spi, dc, cs, rst, width, height, rotation)
98 changes: 63 additions & 35 deletions adafruit_rgb_display/hx8357.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,24 @@
_INVON = const(0x21)
_DISPOFF = const(0x28)
_DISPON = const(0x29)
_CASET = const(0x2a)
_PASET = const(0x2b)
_RAMWR = const(0x2c)
_RAMRD = const(0x2e)
_CASET = const(0x2A)
_PASET = const(0x2B)
_RAMWR = const(0x2C)
_RAMRD = const(0x2E)
_TEON = const(0x35)
_MADCTL = const(0x36)
_COLMOD = const(0x3a)
_COLMOD = const(0x3A)
_TEARLINE = const(0x44)
_SETOSC = const(0xb0)
_SETPWR1 = const(0xb1)
_SETRGB = const(0xb3)
_SETCYC = const(0xb4)
_SETCOM = const(0xb6)
_SETC = const(0xb9)
_SETSTBA = const(0xc0)
_SETPANEL = const(0xcc)
_SETGAMMA = const(0xe0)
_SETOSC = const(0xB0)
_SETPWR1 = const(0xB1)
_SETRGB = const(0xB3)
_SETCYC = const(0xB4)
_SETCOM = const(0xB6)
_SETC = const(0xB9)
_SETSTBA = const(0xC0)
_SETPANEL = const(0xCC)
_SETGAMMA = const(0xE0)


class HX8357(DisplaySPI):
"""
Expand All @@ -73,36 +74,63 @@ class HX8357(DisplaySPI):
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)
"""

_COLUMN_SET = _CASET
_PAGE_SET = _PASET
_RAM_WRITE = _RAMWR
_RAM_READ = _RAMRD
_INIT = (
(_SWRESET, None),
(_SETC, b'\xFF\x83\x57'),
(_SETRGB, b'\x80\x00\x06\x06'), # 0x80 enables SDO pin (0x00 disables)
(_SETCOM, b'\x25'), # -1.52V
(_SETOSC, b'\x68'), # Normal mode 70Hz, Idle mode 55 Hz
(_SETPANEL, b'\x05'), # BGR, Gate direction swapped
(_SETPWR1, b'\x00\x15\x1C\x1C\x83\xAA'), # Not deep standby BT VSPR VSNR AP
(_SETSTBA, b'\x50\x50\x01\x3C\x1E\x08'), # OPON normal OPON idle STBA GEN
(_SETCYC, b'\x02\x40\x00\x2A\x2A\x0D\x78'), # NW 0x02 RTN DIV DUM DUM GDON GDOFF
(_SETGAMMA, b'\x02\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x02' \
b'\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x00\x01'),
(_COLMOD, b'\x55'), # 16 bit
(_MADCTL, b'\xc0'),
(_TEON, b'\x00'),
(_TEARLINE, b'\x00\x02'), # TW off
(_SETC, b"\xFF\x83\x57"),
(_SETRGB, b"\x80\x00\x06\x06"), # 0x80 enables SDO pin (0x00 disables)
(_SETCOM, b"\x25"), # -1.52V
(_SETOSC, b"\x68"), # Normal mode 70Hz, Idle mode 55 Hz
(_SETPANEL, b"\x05"), # BGR, Gate direction swapped
(_SETPWR1, b"\x00\x15\x1C\x1C\x83\xAA"), # Not deep standby BT VSPR VSNR AP
(_SETSTBA, b"\x50\x50\x01\x3C\x1E\x08"), # OPON normal OPON idle STBA GEN
(
_SETCYC,
b"\x02\x40\x00\x2A\x2A\x0D\x78",
), # NW 0x02 RTN DIV DUM DUM GDON GDOFF
(
_SETGAMMA,
b"\x02\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x02"
b"\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x00\x01",
),
(_COLMOD, b"\x55"), # 16 bit
(_MADCTL, b"\xc0"),
(_TEON, b"\x00"),
(_TEARLINE, b"\x00\x02"), # TW off
(_SLPOUT, None),
(_MADCTL, b'\xa0'),
(_MADCTL, b"\xa0"),
(_DISPON, None),
)
_ENCODE_PIXEL = ">H"
_ENCODE_POS = ">HH"

#pylint: disable-msg=useless-super-delegation, too-many-arguments
def __init__(self, spi, dc, cs, rst=None, width=480, height=320,
baudrate=16000000, polarity=0, phase=0, rotation=0):
super().__init__(spi, dc, cs, rst, width, height,
baudrate=baudrate, polarity=polarity, phase=phase,
rotation=rotation)
# pylint: disable-msg=useless-super-delegation, too-many-arguments
def __init__(
self,
spi,
dc,
cs,
rst=None,
width=480,
height=320,
baudrate=16000000,
polarity=0,
phase=0,
rotation=0,
):
super().__init__(
spi,
dc,
cs,
rst,
width,
height,
baudrate=baudrate,
polarity=polarity,
phase=phase,
rotation=rotation,
)
93 changes: 59 additions & 34 deletions adafruit_rgb_display/ili9341.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,52 +55,77 @@ class ILI9341(DisplaySPI):
>>> display.pixel(120, 160, 0)
"""

_COLUMN_SET = 0x2a
_PAGE_SET = 0x2b
_RAM_WRITE = 0x2c
_RAM_READ = 0x2e
_COLUMN_SET = 0x2A
_PAGE_SET = 0x2B
_RAM_WRITE = 0x2C
_RAM_READ = 0x2E
_INIT = (
(0xef, b'\x03\x80\x02'),
(0xcf, b'\x00\xc1\x30'),
(0xed, b'\x64\x03\x12\x81'),
(0xe8, b'\x85\x00\x78'),
(0xcb, b'\x39\x2c\x00\x34\x02'),
(0xf7, b'\x20'),
(0xea, b'\x00\x00'),
(0xc0, b'\x23'), # Power Control 1, VRH[5:0]
(0xc1, b'\x10'), # Power Control 2, SAP[2:0], BT[3:0]
(0xc5, b'\x3e\x28'), # VCM Control 1
(0xc7, b'\x86'), # VCM Control 2
(0x36, b'\x48'), # Memory Access Control
(0x3a, b'\x55'), # Pixel Format
(0xb1, b'\x00\x18'), # FRMCTR1
(0xb6, b'\x08\x82\x27'), # Display Function Control
(0xf2, b'\x00'), # 3Gamma Function Disable
(0x26, b'\x01'), # Gamma Curve Selected
(0xe0, # Set Gamma
b'\x0f\x31\x2b\x0c\x0e\x08\x4e\xf1\x37\x07\x10\x03\x0e\x09\x00'),
(0xe1, # Set Gamma
b'\x00\x0e\x14\x03\x11\x07\x31\xc1\x48\x08\x0f\x0c\x31\x36\x0f'),
(0xEF, b"\x03\x80\x02"),
(0xCF, b"\x00\xc1\x30"),
(0xED, b"\x64\x03\x12\x81"),
(0xE8, b"\x85\x00\x78"),
(0xCB, b"\x39\x2c\x00\x34\x02"),
(0xF7, b"\x20"),
(0xEA, b"\x00\x00"),
(0xC0, b"\x23"), # Power Control 1, VRH[5:0]
(0xC1, b"\x10"), # Power Control 2, SAP[2:0], BT[3:0]
(0xC5, b"\x3e\x28"), # VCM Control 1
(0xC7, b"\x86"), # VCM Control 2
(0x36, b"\x48"), # Memory Access Control
(0x3A, b"\x55"), # Pixel Format
(0xB1, b"\x00\x18"), # FRMCTR1
(0xB6, b"\x08\x82\x27"), # Display Function Control
(0xF2, b"\x00"), # 3Gamma Function Disable
(0x26, b"\x01"), # Gamma Curve Selected
(
0xE0, # Set Gamma
b"\x0f\x31\x2b\x0c\x0e\x08\x4e\xf1\x37\x07\x10\x03\x0e\x09\x00",
),
(
0xE1, # Set Gamma
b"\x00\x0e\x14\x03\x11\x07\x31\xc1\x48\x08\x0f\x0c\x31\x36\x0f",
),
(0x11, None),
(0x29, None),
)
_ENCODE_PIXEL = ">H"
_ENCODE_POS = ">HH"
_DECODE_PIXEL = ">BBB"

#pylint: disable-msg=too-many-arguments
def __init__(self, spi, dc, cs, rst=None, width=240, height=320,
baudrate=16000000, polarity=0, phase=0, rotation=0):
super().__init__(spi, dc, cs, rst=rst, width=width, height=height,
baudrate=baudrate, polarity=polarity, phase=phase,
rotation=rotation)
# pylint: disable-msg=too-many-arguments
def __init__(
self,
spi,
dc,
cs,
rst=None,
width=240,
height=320,
baudrate=16000000,
polarity=0,
phase=0,
rotation=0,
):
super().__init__(
spi,
dc,
cs,
rst=rst,
width=width,
height=height,
baudrate=baudrate,
polarity=polarity,
phase=phase,
rotation=rotation,
)
self._scroll = 0
#pylint: enable-msg=too-many-arguments

def scroll(self, dy=None): #pylint: disable-msg=invalid-name
# pylint: enable-msg=too-many-arguments

def scroll(self, dy=None): # pylint: disable-msg=invalid-name
"""Scroll the display by delta y"""
if dy is None:
return self._scroll
self._scroll = (self._scroll + dy) % self.height
self.write(0x37, struct.pack('>H', self._scroll))
self.write(0x37, struct.pack(">H", self._scroll))
return None
Loading