Skip to content

Commit cc9ed76

Browse files
committed
Ran black, updated to pylint 2.x
1 parent 2a1e178 commit cc9ed76

22 files changed

+881
-549
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
source actions-ci/install.sh
4141
- name: Pip install pylint, black, & Sphinx
4242
run: |
43-
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
43+
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
4444
- name: Library version
4545
run: git describe --dirty --always --tags
4646
- name: PyLint

adafruit_rgb_display/hx8353.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
_INVON = const(0x21)
4141
_DISPOFF = const(0x28)
4242
_DISPON = const(0x29)
43-
_CASET = const(0x2a)
44-
_PASET = const(0x2b)
45-
_RAMWR = const(0x2c)
46-
_RAMRD = const(0x2e)
43+
_CASET = const(0x2A)
44+
_PASET = const(0x2B)
45+
_RAMWR = const(0x2C)
46+
_RAMRD = const(0x2E)
4747
_MADCTL = const(0x36)
48-
_COLMOD = const(0x3a)
48+
_COLMOD = const(0x3A)
49+
4950

5051
class HX8353(DisplaySPI):
5152
"""
@@ -62,6 +63,7 @@ class HX8353(DisplaySPI):
6263
>>> display.fill(0x7521)
6364
>>> display.pixel(64, 64, 0)
6465
"""
66+
6567
_COLUMN_SET = _CASET
6668
_PAGE_SET = _PASET
6769
_RAM_WRITE = _RAMWR
@@ -73,7 +75,6 @@ class HX8353(DisplaySPI):
7375
_ENCODE_PIXEL = ">H"
7476
_ENCODE_POS = ">HH"
7577

76-
#pylint: disable-msg=useless-super-delegation, too-many-arguments
77-
def __init__(self, spi, dc, cs, rst=None, width=128, height=128,
78-
rotation=0):
78+
# pylint: disable-msg=useless-super-delegation, too-many-arguments
79+
def __init__(self, spi, dc, cs, rst=None, width=128, height=128, rotation=0):
7980
super().__init__(spi, dc, cs, rst, width, height, rotation)

adafruit_rgb_display/hx8357.py

Lines changed: 63 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,24 @@
4040
_INVON = const(0x21)
4141
_DISPOFF = const(0x28)
4242
_DISPON = const(0x29)
43-
_CASET = const(0x2a)
44-
_PASET = const(0x2b)
45-
_RAMWR = const(0x2c)
46-
_RAMRD = const(0x2e)
43+
_CASET = const(0x2A)
44+
_PASET = const(0x2B)
45+
_RAMWR = const(0x2C)
46+
_RAMRD = const(0x2E)
4747
_TEON = const(0x35)
4848
_MADCTL = const(0x36)
49-
_COLMOD = const(0x3a)
49+
_COLMOD = const(0x3A)
5050
_TEARLINE = const(0x44)
51-
_SETOSC = const(0xb0)
52-
_SETPWR1 = const(0xb1)
53-
_SETRGB = const(0xb3)
54-
_SETCYC = const(0xb4)
55-
_SETCOM = const(0xb6)
56-
_SETC = const(0xb9)
57-
_SETSTBA = const(0xc0)
58-
_SETPANEL = const(0xcc)
59-
_SETGAMMA = const(0xe0)
51+
_SETOSC = const(0xB0)
52+
_SETPWR1 = const(0xB1)
53+
_SETRGB = const(0xB3)
54+
_SETCYC = const(0xB4)
55+
_SETCOM = const(0xB6)
56+
_SETC = const(0xB9)
57+
_SETSTBA = const(0xC0)
58+
_SETPANEL = const(0xCC)
59+
_SETGAMMA = const(0xE0)
60+
6061

6162
class HX8357(DisplaySPI):
6263
"""
@@ -73,36 +74,63 @@ class HX8357(DisplaySPI):
7374
>>> display.fill(0x7521)
7475
>>> display.pixel(64, 64, 0)
7576
"""
77+
7678
_COLUMN_SET = _CASET
7779
_PAGE_SET = _PASET
7880
_RAM_WRITE = _RAMWR
7981
_RAM_READ = _RAMRD
8082
_INIT = (
8183
(_SWRESET, None),
82-
(_SETC, b'\xFF\x83\x57'),
83-
(_SETRGB, b'\x80\x00\x06\x06'), # 0x80 enables SDO pin (0x00 disables)
84-
(_SETCOM, b'\x25'), # -1.52V
85-
(_SETOSC, b'\x68'), # Normal mode 70Hz, Idle mode 55 Hz
86-
(_SETPANEL, b'\x05'), # BGR, Gate direction swapped
87-
(_SETPWR1, b'\x00\x15\x1C\x1C\x83\xAA'), # Not deep standby BT VSPR VSNR AP
88-
(_SETSTBA, b'\x50\x50\x01\x3C\x1E\x08'), # OPON normal OPON idle STBA GEN
89-
(_SETCYC, b'\x02\x40\x00\x2A\x2A\x0D\x78'), # NW 0x02 RTN DIV DUM DUM GDON GDOFF
90-
(_SETGAMMA, b'\x02\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x02' \
91-
b'\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x00\x01'),
92-
(_COLMOD, b'\x55'), # 16 bit
93-
(_MADCTL, b'\xc0'),
94-
(_TEON, b'\x00'),
95-
(_TEARLINE, b'\x00\x02'), # TW off
84+
(_SETC, b"\xFF\x83\x57"),
85+
(_SETRGB, b"\x80\x00\x06\x06"), # 0x80 enables SDO pin (0x00 disables)
86+
(_SETCOM, b"\x25"), # -1.52V
87+
(_SETOSC, b"\x68"), # Normal mode 70Hz, Idle mode 55 Hz
88+
(_SETPANEL, b"\x05"), # BGR, Gate direction swapped
89+
(_SETPWR1, b"\x00\x15\x1C\x1C\x83\xAA"), # Not deep standby BT VSPR VSNR AP
90+
(_SETSTBA, b"\x50\x50\x01\x3C\x1E\x08"), # OPON normal OPON idle STBA GEN
91+
(
92+
_SETCYC,
93+
b"\x02\x40\x00\x2A\x2A\x0D\x78",
94+
), # NW 0x02 RTN DIV DUM DUM GDON GDOFF
95+
(
96+
_SETGAMMA,
97+
b"\x02\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x02"
98+
b"\x0A\x11\x1d\x23\x35\x41\x4b\x4b\x42\x3A\x27\x1B\x08\x09\x03\x00\x01",
99+
),
100+
(_COLMOD, b"\x55"), # 16 bit
101+
(_MADCTL, b"\xc0"),
102+
(_TEON, b"\x00"),
103+
(_TEARLINE, b"\x00\x02"), # TW off
96104
(_SLPOUT, None),
97-
(_MADCTL, b'\xa0'),
105+
(_MADCTL, b"\xa0"),
98106
(_DISPON, None),
99107
)
100108
_ENCODE_PIXEL = ">H"
101109
_ENCODE_POS = ">HH"
102110

103-
#pylint: disable-msg=useless-super-delegation, too-many-arguments
104-
def __init__(self, spi, dc, cs, rst=None, width=480, height=320,
105-
baudrate=16000000, polarity=0, phase=0, rotation=0):
106-
super().__init__(spi, dc, cs, rst, width, height,
107-
baudrate=baudrate, polarity=polarity, phase=phase,
108-
rotation=rotation)
111+
# pylint: disable-msg=useless-super-delegation, too-many-arguments
112+
def __init__(
113+
self,
114+
spi,
115+
dc,
116+
cs,
117+
rst=None,
118+
width=480,
119+
height=320,
120+
baudrate=16000000,
121+
polarity=0,
122+
phase=0,
123+
rotation=0,
124+
):
125+
super().__init__(
126+
spi,
127+
dc,
128+
cs,
129+
rst,
130+
width,
131+
height,
132+
baudrate=baudrate,
133+
polarity=polarity,
134+
phase=phase,
135+
rotation=rotation,
136+
)

adafruit_rgb_display/ili9341.py

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -55,52 +55,77 @@ class ILI9341(DisplaySPI):
5555
>>> display.pixel(120, 160, 0)
5656
"""
5757

58-
_COLUMN_SET = 0x2a
59-
_PAGE_SET = 0x2b
60-
_RAM_WRITE = 0x2c
61-
_RAM_READ = 0x2e
58+
_COLUMN_SET = 0x2A
59+
_PAGE_SET = 0x2B
60+
_RAM_WRITE = 0x2C
61+
_RAM_READ = 0x2E
6262
_INIT = (
63-
(0xef, b'\x03\x80\x02'),
64-
(0xcf, b'\x00\xc1\x30'),
65-
(0xed, b'\x64\x03\x12\x81'),
66-
(0xe8, b'\x85\x00\x78'),
67-
(0xcb, b'\x39\x2c\x00\x34\x02'),
68-
(0xf7, b'\x20'),
69-
(0xea, b'\x00\x00'),
70-
(0xc0, b'\x23'), # Power Control 1, VRH[5:0]
71-
(0xc1, b'\x10'), # Power Control 2, SAP[2:0], BT[3:0]
72-
(0xc5, b'\x3e\x28'), # VCM Control 1
73-
(0xc7, b'\x86'), # VCM Control 2
74-
(0x36, b'\x48'), # Memory Access Control
75-
(0x3a, b'\x55'), # Pixel Format
76-
(0xb1, b'\x00\x18'), # FRMCTR1
77-
(0xb6, b'\x08\x82\x27'), # Display Function Control
78-
(0xf2, b'\x00'), # 3Gamma Function Disable
79-
(0x26, b'\x01'), # Gamma Curve Selected
80-
(0xe0, # Set Gamma
81-
b'\x0f\x31\x2b\x0c\x0e\x08\x4e\xf1\x37\x07\x10\x03\x0e\x09\x00'),
82-
(0xe1, # Set Gamma
83-
b'\x00\x0e\x14\x03\x11\x07\x31\xc1\x48\x08\x0f\x0c\x31\x36\x0f'),
63+
(0xEF, b"\x03\x80\x02"),
64+
(0xCF, b"\x00\xc1\x30"),
65+
(0xED, b"\x64\x03\x12\x81"),
66+
(0xE8, b"\x85\x00\x78"),
67+
(0xCB, b"\x39\x2c\x00\x34\x02"),
68+
(0xF7, b"\x20"),
69+
(0xEA, b"\x00\x00"),
70+
(0xC0, b"\x23"), # Power Control 1, VRH[5:0]
71+
(0xC1, b"\x10"), # Power Control 2, SAP[2:0], BT[3:0]
72+
(0xC5, b"\x3e\x28"), # VCM Control 1
73+
(0xC7, b"\x86"), # VCM Control 2
74+
(0x36, b"\x48"), # Memory Access Control
75+
(0x3A, b"\x55"), # Pixel Format
76+
(0xB1, b"\x00\x18"), # FRMCTR1
77+
(0xB6, b"\x08\x82\x27"), # Display Function Control
78+
(0xF2, b"\x00"), # 3Gamma Function Disable
79+
(0x26, b"\x01"), # Gamma Curve Selected
80+
(
81+
0xE0, # Set Gamma
82+
b"\x0f\x31\x2b\x0c\x0e\x08\x4e\xf1\x37\x07\x10\x03\x0e\x09\x00",
83+
),
84+
(
85+
0xE1, # Set Gamma
86+
b"\x00\x0e\x14\x03\x11\x07\x31\xc1\x48\x08\x0f\x0c\x31\x36\x0f",
87+
),
8488
(0x11, None),
8589
(0x29, None),
8690
)
8791
_ENCODE_PIXEL = ">H"
8892
_ENCODE_POS = ">HH"
8993
_DECODE_PIXEL = ">BBB"
9094

91-
#pylint: disable-msg=too-many-arguments
92-
def __init__(self, spi, dc, cs, rst=None, width=240, height=320,
93-
baudrate=16000000, polarity=0, phase=0, rotation=0):
94-
super().__init__(spi, dc, cs, rst=rst, width=width, height=height,
95-
baudrate=baudrate, polarity=polarity, phase=phase,
96-
rotation=rotation)
95+
# pylint: disable-msg=too-many-arguments
96+
def __init__(
97+
self,
98+
spi,
99+
dc,
100+
cs,
101+
rst=None,
102+
width=240,
103+
height=320,
104+
baudrate=16000000,
105+
polarity=0,
106+
phase=0,
107+
rotation=0,
108+
):
109+
super().__init__(
110+
spi,
111+
dc,
112+
cs,
113+
rst=rst,
114+
width=width,
115+
height=height,
116+
baudrate=baudrate,
117+
polarity=polarity,
118+
phase=phase,
119+
rotation=rotation,
120+
)
97121
self._scroll = 0
98-
#pylint: enable-msg=too-many-arguments
99122

100-
def scroll(self, dy=None): #pylint: disable-msg=invalid-name
123+
# pylint: enable-msg=too-many-arguments
124+
125+
def scroll(self, dy=None): # pylint: disable-msg=invalid-name
101126
"""Scroll the display by delta y"""
102127
if dy is None:
103128
return self._scroll
104129
self._scroll = (self._scroll + dy) % self.height
105-
self.write(0x37, struct.pack('>H', self._scroll))
130+
self.write(0x37, struct.pack(">H", self._scroll))
106131
return None

0 commit comments

Comments
 (0)