Skip to content

Commit 6e0ec5c

Browse files
committed
fixes requested for reviewer
1 parent 76e40ba commit 6e0ec5c

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

adafruit_rgb_display/hx8353.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class HX8353(DisplaySPI):
3030
>>> import adafruit_rgb_display.hx8353 as hx8353
3131
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
3232
>>> display = hx8353.HX8383(spi, cs=digitalio.DigitalInOut(board.GPIO0),
33-
dc=digitalio.DigitalInOut(board.GPIO15))
33+
... dc=digitalio.DigitalInOut(board.GPIO15))
3434
>>> display.fill(0x7521)
3535
>>> display.pixel(64, 64, 0)
3636
"""

adafruit_rgb_display/ili9341.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ILI9341(DisplaySPI):
2222
>>> import adafruit_rgb_display.ili9341 as ili9341
2323
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
2424
>>> display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(board.GPIO0),
25-
dc=digitalio.DigitalInOut(board.GPIO15))
25+
... dc=digitalio.DigitalInOut(board.GPIO15))
2626
>>> display.fill(color565(0xff, 0x11, 0x22))
2727
>>> display.pixel(120, 160, 0)
2828
"""
@@ -68,10 +68,10 @@ def __init__(self, spi, dc, cs, rst=None, width=240, height=320,
6868
self._scroll = 0
6969
#pylint: enable-msg=too-many-arguments
7070

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

adafruit_rgb_display/rgb.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ def _block(self, xpos0, ypos0, xpos1, ypos1, data=None):
7070
return None
7171
#pylint: enable-msg=too-many-arguments
7272

73-
def _encode_pos(self, avalue, bvalue):
73+
def _encode_pos(self, x, y): #pylint: disable-msg=invalid-name
7474
"""Encode a postion into bytes."""
75-
return struct.pack(self._ENCODE_POS, avalue, bvalue)
75+
return struct.pack(self._ENCODE_POS, x, y)
7676

7777
def _encode_pixel(self, color):
7878
"""Encode a pixel color into bytes."""
@@ -82,23 +82,23 @@ def _decode_pixel(self, data):
8282
"""Decode bytes into a pixel color."""
8383
return color565(*struct.unpack(self._DECODE_PIXEL, data))
8484

85-
def pixel(self, xpos, ypos, color=None):
85+
def pixel(self, x, y, color=None): #pylint: disable-msg=invalid-name
8686
"""Read or write a pixel."""
8787
if color is None:
88-
return self._decode_pixel(self._block(xpos, ypos, xpos, ypos))
88+
return self._decode_pixel(self._block(x, y, x, y))
8989

90-
if 0 <= xpos < self.width and 0 <= ypos < self.height:
91-
self._block(xpos, ypos, xpos, ypos, self._encode_pixel(color))
90+
if 0 <= x < self.width and 0 <= y < self.height:
91+
self._block(x, y, x, y, self._encode_pixel(color))
9292
return None
9393

9494
#pylint: disable-msg=too-many-arguments
95-
def fill_rectangle(self, xpos, ypos, width, height, color):
95+
def fill_rectangle(self, x, y, width, height, color): #pylint: disable-msg=invalid-name
9696
"""Draw a filled rectangle."""
97-
xpos = min(self.width - 1, max(0, xpos))
98-
ypos = min(self.height - 1, max(0, ypos))
99-
width = min(self.width - xpos, max(1, width))
100-
height = min(self.height - ypos, max(1, height))
101-
self._block(xpos, ypos, xpos + width - 1, ypos + height - 1, b'')
97+
x = min(self.width - 1, max(0, x))
98+
y = min(self.height - 1, max(0, y))
99+
width = min(self.width - x, max(1, width))
100+
height = min(self.height - y, max(1, height))
101+
self._block(x, y, x + width - 1, y + height - 1, b'')
102102
chunks, rest = divmod(width * height, _BUFFER_SIZE)
103103
pixel = self._encode_pixel(color)
104104
if chunks:
@@ -112,13 +112,13 @@ def fill(self, color=0):
112112
"""Fill whole screen."""
113113
self.fill_rectangle(0, 0, self.width, self.height, color)
114114

115-
def hline(self, xpos, ypos, width, color):
115+
def hline(self, x, y, width, color): #pylint: disable-msg=invalid-name
116116
"""Draw a horizontal line."""
117-
self.fill_rectangle(xpos, ypos, width, 1, color)
117+
self.fill_rectangle(x, y, width, 1, color)
118118

119-
def vline(self, xpos, ypos, height, color):
119+
def vline(self, x, y, height, color): #pylint: disable-msg=invalid-name
120120
"""Draw a vertical line."""
121-
self.fill_rectangle(xpos, ypos, 1, height, color)
121+
self.fill_rectangle(x, y, 1, height, color)
122122

123123
def write(self, command, data):
124124
"""Derived class must implement this"""
@@ -135,9 +135,9 @@ def __init__(self, spi, dc, cs, rst=None, width=1, height=1, baudrate=1000000,
135135
polarity=0, phase=0):
136136
self.spi_device = spi_device.SPIDevice(spi, cs, baudrate=baudrate,
137137
polarity=polarity, phase=phase)
138-
self.d_or_c = dc
138+
self.dc_pin = dc
139139
self.rst = rst
140-
self.d_or_c.switch_to_output(value=0)
140+
self.dc_pin.switch_to_output(value=0)
141141
if self.rst:
142142
self.rst.switch_to_output(value=0)
143143
self.reset()
@@ -154,18 +154,18 @@ def reset(self):
154154
def write(self, command=None, data=None):
155155
"""SPI write to the device: commands and data"""
156156
if command is not None:
157-
self.d_or_c.value = 0
157+
self.dc_pin.value = 0
158158
with self.spi_device as spi:
159159
spi.write(bytearray([command]))
160160
if data is not None:
161-
self.d_or_c.value = 1
161+
self.dc_pin.value = 1
162162
with self.spi_device as spi:
163163
spi.write(data)
164164

165165
def read(self, command=None, count=0):
166166
"""SPI read from device with optional command"""
167167
data = bytearray(count)
168-
self.d_or_c.value = 0
168+
self.dc_pin.value = 0
169169
with self.spi_device as spi:
170170
if command is not None:
171171
spi.write(bytearray([command]))

adafruit_rgb_display/s6d02a1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class S6D02A1(DisplaySPI):
2727
>>> import adafruit_rgb_display.s6d02a1 as s6d02a1
2828
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
2929
>>> display = s6d02a1.S6D02A1(spi, cs=digitalio.DigitalInOut(board.GPIO0),
30-
dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
30+
... dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
3131
>>> display.fill(0x7521)
3232
>>> display.pixel(64, 64, 0)
3333
"""

adafruit_rgb_display/ssd1331.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SSD1331(DisplaySPI):
4949
>>> import adafruit_rgb_display.ssd1331 as ssd1331
5050
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
5151
>>> display = ssd1331.SSD1331(spi, cs=digitalio.DigitalInOut(board.GPIO0),
52-
dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
52+
... dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
5353
>>> display.fill(0x7521)
5454
>>> display.pixel(32, 32, 0)
5555
>>>
@@ -88,7 +88,7 @@ class SSD1331(DisplaySPI):
8888
# (_CONTRASTA, b'\x91'), #//0xEF - 0x91
8989
# (_CONTRASTB, b'\x50'), #;//0x11 - 0x50
9090
# (_CONTRASTC, b'\x7d'), #;//0x48 - 0x7D
91-
# (_DISPLAYON, b''),
91+
(_DISPLAYON, b''),
9292
)
9393
_ENCODE_PIXEL = ">H"
9494
_ENCODE_POS = ">BB"

adafruit_rgb_display/ssd1351.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SSD1351(DisplaySPI):
4949
>>> import adafruit_rgb_display.ssd1351 as ssd1351
5050
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
5151
>>> display = ssd1351.SSD1351(spi, cs=digitalio.DigitalInOut(board.GPIO0),
52-
dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
52+
... dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
5353
>>> display.fill(0x7521)
5454
>>> display.pixel(32, 32, 0)
5555
"""

adafruit_rgb_display/st7735.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ST7735(DisplaySPI):
6868
>>> import adafruit_rgb_display.st7735 as st7735
6969
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
7070
>>> display = st7735.ST7735(spi, cs=digitalio.DigitalInOut(board.GPIO0),
71-
dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
71+
... dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
7272
>>> display.fill(0x7521)
7373
>>> display.pixel(64, 64, 0)
7474
"""

0 commit comments

Comments
 (0)