Skip to content

Commit 4c51a6d

Browse files
authored
Merge pull request #6 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 28ab6a6 + ba434f1 commit 4c51a6d

File tree

5 files changed

+108
-77
lines changed

5 files changed

+108
-77
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 pylint black==19.10b0 Sphinx sphinx-rtd-theme
4444
- name: Library version
4545
run: git describe --dirty --always --tags
4646
- name: PyLint

adafruit_ssd1322.py

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,47 +49,58 @@
4949
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1322.git"
5050

5151
_INIT_SEQUENCE = (
52-
b"\xfd\x01\x12" # Set_Command_Lock(0x12);// Unlock Basic Commands (0x12/0x16)
53-
b"\xae\x00" # Set_Display_On_Off(0x00);// Display Off (0x00/0x01)
54-
b"\xb3\x01\x91" # Set_Display_Clock(0x91);// Set Clock as 80 Frames/Sec
55-
b"\xca\x01\x3f" # Set_Multiplex_Ratio(0x3F);// 1/64 Duty (0x0F~0x3F)
56-
b"\xa2\x01\x00" # Set_Display_Offset(0x00);// Shift Mapping RAM Counter (0x00~0x3F)
57-
b"\xa1\x01\x00" # Set_Start_Line(0x00);// Set Mapping RAM Display Start Line (0x00~0x7F)
58-
b"\xa0\x02\x14\x11" # Set_Remap_Format(0x14);// Set Horizontal Address Increment
52+
b"\xfd\x01\x12" # Set_Command_Lock(0x12);// Unlock Basic Commands (0x12/0x16)
53+
b"\xae\x00" # Set_Display_On_Off(0x00);// Display Off (0x00/0x01)
54+
b"\xb3\x01\x91" # Set_Display_Clock(0x91);// Set Clock as 80 Frames/Sec
55+
b"\xca\x01\x3f" # Set_Multiplex_Ratio(0x3F);// 1/64 Duty (0x0F~0x3F)
56+
b"\xa2\x01\x00" # Set_Display_Offset(0x00);// Shift Mapping RAM Counter (0x00~0x3F)
57+
b"\xa1\x01\x00" # Set_Start_Line(0x00);// Set Mapping RAM Display Start Line (0x00~0x7F)
58+
b"\xa0\x02\x14\x11" # Set_Remap_Format(0x14);// Set Horizontal Address Increment
5959
# // Column Address 0 Mapped to SEG0
6060
# // Disable Nibble Remap
6161
# // Scan from COM[N-1] to COM0
6262
# // Disable COM Split Odd Even
6363
# // Enable Dual COM Line Mode
64-
b"\xb5\x01\x00" # Set_GPIO(0x00);// Disable GPIO Pins Input
65-
b"\xab\x01\x01" # Set_Function_Selection(0x01);// Enable Internal VDD Regulator
66-
b"\xb4\x02\xa0\xfd" # Set_Display_Enhancement_A(0xA0,0xFD);// Enable External VSL
67-
b"\xc1\x01\x9f" # Set_Contrast_Current(0x9F); // Set Segment Output Current
68-
b"\xc7\x01\x0f" # Set_Master_Current(0x0F);// Set Scale Factor of Segment Output Current Control
64+
b"\xb5\x01\x00" # Set_GPIO(0x00);// Disable GPIO Pins Input
65+
b"\xab\x01\x01" # Set_Function_Selection(0x01);// Enable Internal VDD Regulator
66+
b"\xb4\x02\xa0\xfd" # Set_Display_Enhancement_A(0xA0,0xFD);// Enable External VSL
67+
b"\xc1\x01\x9f" # Set_Contrast_Current(0x9F); // Set Segment Output Current
68+
b"\xc7\x01\x0f" # Set_Master_Current(0x0F);//Set Scale Factor of Segment Output Current Control
6969
b"\xb8\x0f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x10\x40\x90\xa0\xb0\xb4" # Set graytable
7070
# b"\xb9\x00" # Set_Linear_Gray_Scale_Table();//set default linear gray scale table
71-
b"\xb1\x01\xe2" # Set_Phase_Length(0xE2);// Set Phase 1 as 5 Clocks & Phase 2 as 14 Clocks
71+
b"\xb1\x01\xe2" # Set_Phase_Length(0xE2);// Set Phase 1 as 5 Clocks & Phase 2 as 14 Clocks
7272
# Set_Display_Enhancement_B(0x20);// Enhance Driving Scheme Capability (0x00/0x20)
7373
b"\xd1\x02\xa2\x20"
74-
b"\xbb\x01\x1f" # Set_Precharge_Voltage(0x1F);// Set Pre-Charge Voltage Level as 0.60*VCC
75-
b"\xb6\x01\x08" # Set_Precharge_Period(0x08);// Set Second Pre-Charge Period as 8 Clocks
76-
b"\xbe\x01\x07" # Set_VCOMH(0x07);// Set Common Pins Deselect Voltage Level as 0.86*VCC
77-
b"\xa6\x00" # Set_Display_Mode(0x02);// Normal Display Mode (0x00/0x01/0x02/0x03)
78-
b"\xa9\x00" # Set_Partial_Display(0x01,0x00,0x00);// Disable Partial Display
79-
b"\xaf\x00" # Set_Display_On_Off(0x01);
74+
b"\xbb\x01\x1f" # Set_Precharge_Voltage(0x1F);// Set Pre-Charge Voltage Level as 0.60*VCC
75+
b"\xb6\x01\x08" # Set_Precharge_Period(0x08);// Set Second Pre-Charge Period as 8 Clocks
76+
b"\xbe\x01\x07" # Set_VCOMH(0x07);// Set Common Pins Deselect Voltage Level as 0.86*VCC
77+
b"\xa6\x00" # Set_Display_Mode(0x02);// Normal Display Mode (0x00/0x01/0x02/0x03)
78+
b"\xa9\x00" # Set_Partial_Display(0x01,0x00,0x00);// Disable Partial Display
79+
b"\xaf\x00" # Set_Display_On_Off(0x01);
8080
)
8181

8282
# pylint: disable=too-few-public-methods
8383
class SSD1322(displayio.Display):
8484
"""SSD1322 driver"""
85+
8586
def __init__(self, bus, **kwargs):
8687
# Patch the init sequence for 32 pixel high displays.
8788
init_sequence = bytearray(_INIT_SEQUENCE)
8889
height = kwargs["height"]
8990
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
9091
height = kwargs["width"]
91-
init_sequence[10] = height - 1 # patch mux ratio
92-
super().__init__(bus, _INIT_SEQUENCE, **kwargs, color_depth=4, grayscale=True,
93-
set_column_command=0x15, set_row_command=0x75,
94-
set_vertical_scroll=0xd3, write_ram_command=0x5c,
95-
single_byte_bounds=True, reverse_pixels_in_byte=True, bytes_per_cell=2)
92+
init_sequence[10] = height - 1 # patch mux ratio
93+
super().__init__(
94+
bus,
95+
_INIT_SEQUENCE,
96+
**kwargs,
97+
color_depth=4,
98+
grayscale=True,
99+
set_column_command=0x15,
100+
set_row_command=0x75,
101+
set_vertical_scroll=0xD3,
102+
write_ram_command=0x5C,
103+
single_byte_bounds=True,
104+
reverse_pixels_in_byte=True,
105+
bytes_per_cell=2,
106+
)

docs/conf.py

Lines changed: 65 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
import os
44
import sys
5-
sys.path.insert(0, os.path.abspath('..'))
5+
6+
sys.path.insert(0, os.path.abspath(".."))
67

78
# -- General configuration ------------------------------------------------
89

910
# Add any Sphinx extension module names here, as strings. They can be
1011
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
1112
# ones.
1213
extensions = [
13-
'sphinx.ext.autodoc',
14-
'sphinx.ext.intersphinx',
15-
'sphinx.ext.napoleon',
16-
'sphinx.ext.todo',
14+
"sphinx.ext.autodoc",
15+
"sphinx.ext.intersphinx",
16+
"sphinx.ext.napoleon",
17+
"sphinx.ext.todo",
1718
]
1819

1920
# TODO: Please Read!
@@ -23,29 +24,32 @@
2324
autodoc_mock_imports = ["displayio"]
2425

2526

26-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
27+
intersphinx_mapping = {
28+
"python": ("https://docs.python.org/3.4", None),
29+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
30+
}
2731

2832
# Add any paths that contain templates here, relative to this directory.
29-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3034

31-
source_suffix = '.rst'
35+
source_suffix = ".rst"
3236

3337
# The master toctree document.
34-
master_doc = 'index'
38+
master_doc = "index"
3539

3640
# General information about the project.
37-
project = u'Adafruit SSD1322 Library'
38-
copyright = u'2019 Scott Shawcroft'
39-
author = u'Scott Shawcroft'
41+
project = "Adafruit SSD1322 Library"
42+
copyright = "2019 Scott Shawcroft"
43+
author = "Scott Shawcroft"
4044

4145
# The version info for the project you're documenting, acts as replacement for
4246
# |version| and |release|, also used in various other places throughout the
4347
# built documents.
4448
#
4549
# The short X.Y version.
46-
version = u'1.0'
50+
version = "1.0"
4751
# The full version, including alpha/beta/rc tags.
48-
release = u'1.0'
52+
release = "1.0"
4953

5054
# The language for content autogenerated by Sphinx. Refer to documentation
5155
# for a list of supported languages.
@@ -57,7 +61,7 @@
5761
# List of patterns, relative to source directory, that match files and
5862
# directories to ignore when looking for source files.
5963
# This patterns also effect to html_static_path and html_extra_path
60-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
64+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6165

6266
# The reST default role (used for this markup: `text`) to use for all
6367
# documents.
@@ -69,7 +73,7 @@
6973
add_function_parentheses = True
7074

7175
# The name of the Pygments (syntax highlighting) style to use.
72-
pygments_style = 'sphinx'
76+
pygments_style = "sphinx"
7377

7478
# If true, `todo` and `todoList` produce output, else they produce nothing.
7579
todo_include_todos = False
@@ -84,68 +88,76 @@
8488
# The theme to use for HTML and HTML Help pages. See the documentation for
8589
# a list of builtin themes.
8690
#
87-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
91+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8892

8993
if not on_rtd: # only import and set the theme if we're building docs locally
9094
try:
9195
import sphinx_rtd_theme
92-
html_theme = 'sphinx_rtd_theme'
93-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
96+
97+
html_theme = "sphinx_rtd_theme"
98+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
9499
except:
95-
html_theme = 'default'
96-
html_theme_path = ['.']
100+
html_theme = "default"
101+
html_theme_path = ["."]
97102
else:
98-
html_theme_path = ['.']
103+
html_theme_path = ["."]
99104

100105
# Add any paths that contain custom static files (such as style sheets) here,
101106
# relative to this directory. They are copied after the builtin static files,
102107
# so a file named "default.css" will overwrite the builtin "default.css".
103-
html_static_path = ['_static']
108+
html_static_path = ["_static"]
104109

105110
# The name of an image file (relative to this directory) to use as a favicon of
106111
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
107112
# pixels large.
108113
#
109-
html_favicon = '_static/favicon.ico'
114+
html_favicon = "_static/favicon.ico"
110115

111116
# Output file base name for HTML help builder.
112-
htmlhelp_basename = 'AdafruitSsd1322Librarydoc'
117+
htmlhelp_basename = "AdafruitSsd1322Librarydoc"
113118

114119
# -- Options for LaTeX output ---------------------------------------------
115120

116121
latex_elements = {
117-
# The paper size ('letterpaper' or 'a4paper').
118-
#
119-
# 'papersize': 'letterpaper',
120-
121-
# The font size ('10pt', '11pt' or '12pt').
122-
#
123-
# 'pointsize': '10pt',
124-
125-
# Additional stuff for the LaTeX preamble.
126-
#
127-
# 'preamble': '',
128-
129-
# Latex figure (float) alignment
130-
#
131-
# 'figure_align': 'htbp',
122+
# The paper size ('letterpaper' or 'a4paper').
123+
#
124+
# 'papersize': 'letterpaper',
125+
# The font size ('10pt', '11pt' or '12pt').
126+
#
127+
# 'pointsize': '10pt',
128+
# Additional stuff for the LaTeX preamble.
129+
#
130+
# 'preamble': '',
131+
# Latex figure (float) alignment
132+
#
133+
# 'figure_align': 'htbp',
132134
}
133135

134136
# Grouping the document tree into LaTeX files. List of tuples
135137
# (source start file, target name, title,
136138
# author, documentclass [howto, manual, or own class]).
137139
latex_documents = [
138-
(master_doc, 'AdafruitSSD1322Library.tex', u'AdafruitSSD1322 Library Documentation',
139-
author, 'manual'),
140+
(
141+
master_doc,
142+
"AdafruitSSD1322Library.tex",
143+
"AdafruitSSD1322 Library Documentation",
144+
author,
145+
"manual",
146+
),
140147
]
141148

142149
# -- Options for manual page output ---------------------------------------
143150

144151
# One entry per manual page. List of tuples
145152
# (source start file, name, description, authors, manual section).
146153
man_pages = [
147-
(master_doc, 'AdafruitSSD1322library', u'Adafruit SSD1322 Library Documentation',
148-
[author], 1)
154+
(
155+
master_doc,
156+
"AdafruitSSD1322library",
157+
"Adafruit SSD1322 Library Documentation",
158+
[author],
159+
1,
160+
)
149161
]
150162

151163
# -- Options for Texinfo output -------------------------------------------
@@ -154,7 +166,13 @@
154166
# (source start file, target name, title, author,
155167
# dir menu entry, description, category)
156168
texinfo_documents = [
157-
(master_doc, 'AdafruitSSD1322Library', u'Adafruit SSD1322 Library Documentation',
158-
author, 'AdafruitSSD1322Library', 'One line description of project.',
159-
'Miscellaneous'),
169+
(
170+
master_doc,
171+
"AdafruitSSD1322Library",
172+
"Adafruit SSD1322 Library Documentation",
173+
author,
174+
"AdafruitSSD1322Library",
175+
"One line description of project.",
176+
"Miscellaneous",
177+
),
160178
]

examples/ssd1322_gamma.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
tft_dc = board.D9
1313
tft_reset = board.D5
1414

15-
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset,
16-
baudrate=1000000)
15+
display_bus = displayio.FourWire(
16+
spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset, baudrate=1000000
17+
)
1718
time.sleep(1)
1819
display = adafruit_ssd1322.SSD1322(display_bus, width=256, height=64, colstart=28)
1920

@@ -29,7 +30,7 @@
2930
for i in range(dimension):
3031
if i % pixels_per_step == 0:
3132
continue
32-
gamma_pattern[i,i] = i // pixels_per_step
33+
gamma_pattern[i, i] = i // pixels_per_step
3334

3435
for i in range(color_count):
3536
component = i * 255 // (color_count - 1)

examples/ssd1322_simpletest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
tft_dc = board.D9
1313
tft_reset = board.D5
1414

15-
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs,
16-
reset=tft_reset, baudrate=1000000)
15+
display_bus = displayio.FourWire(
16+
spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset, baudrate=1000000
17+
)
1718
time.sleep(1)
1819
display = adafruit_ssd1322.SSD1322(display_bus, width=256, height=64, colstart=28)

0 commit comments

Comments
 (0)