Skip to content

Commit

Permalink
Merge pull request #5 from adafruit/pylint-update
Browse files Browse the repository at this point in the history
Ran black, updated to pylint 2.x
  • Loading branch information
kattni authored Mar 9, 2020
2 parents 3e4f705 + e393e9c commit 59bde46
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 70 deletions.
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 pylint black==19.10b0 Sphinx sphinx-rtd-theme
- name: Library version
run: git describe --dirty --always --tags
- name: PyLint
Expand Down
43 changes: 25 additions & 18 deletions adafruit_ssd1608.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,40 @@
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1608.git"

_START_SEQUENCE = (
b"\x12\x00" # Software reset
b"\x01\x03\x00\x00\x00" # driver output control
b"\x3a\x01\x1b" # Set dummy line period
b"\x3b\x01\x0b" # Set gate line width
b"\x11\x01\x03" # Data entry sequence
b"\x2c\x01\x70" # Vcom Voltage
b"\x12\x00" # Software reset
b"\x01\x03\x00\x00\x00" # driver output control
b"\x3a\x01\x1b" # Set dummy line period
b"\x3b\x01\x0b" # Set gate line width
b"\x11\x01\x03" # Data entry sequence
b"\x2c\x01\x70" # Vcom Voltage
b"\x32\x1e\x02\x02\x01\x11\x12\x12\x22\x22\x66\x69\x69\x59\x58\x99\x99\x88\x00\x00\x00\x00\xf8"
b"\xb4\x13\x51\x35\x51\x51\x19\x01\x00" # LUT
b"\x22\x01\xc7" # Set DISP ctrl2
b"\xb4\x13\x51\x35\x51\x51\x19\x01\x00" # LUT
b"\x22\x01\xc7" # Set DISP ctrl2
)

_STOP_SEQUENCE = (
b"\x10\x01\x01" # Enter deep sleep
)
_STOP_SEQUENCE = b"\x10\x01\x01" # Enter deep sleep

# pylint: disable=too-few-public-methods
class SSD1608(displayio.EPaperDisplay):
"""SSD1608 driver"""

def __init__(self, bus, **kwargs):
start_sequence = bytearray(_START_SEQUENCE)
width = kwargs["width"]
start_sequence[4] = (width - 1) & 0xff
start_sequence[4] = (width - 1) & 0xFF
start_sequence[5] = (width - 1) >> 8

super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
ram_width=240, ram_height=320,
set_column_window_command=0x44, set_row_window_command=0x45,
set_current_column_command=0x4e, set_current_row_command=0x4f,
write_black_ram_command=0x24,
refresh_display_command=0x20)
super().__init__(
bus,
start_sequence,
_STOP_SEQUENCE,
**kwargs,
ram_width=240,
ram_height=320,
set_column_window_command=0x44,
set_row_window_command=0x45,
set_current_column_command=0x4E,
set_current_row_command=0x4F,
write_black_ram_command=0x24,
refresh_display_command=0x20,
)
112 changes: 65 additions & 47 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

import os
import sys
sys.path.insert(0, os.path.abspath('..'))

sys.path.insert(0, os.path.abspath(".."))

# -- General configuration ------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
]

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


intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'Adafruit SSD1608 Library'
copyright = u'2019 Scott Shawcroft'
author = u'Scott Shawcroft'
project = "Adafruit SSD1608 Library"
copyright = "2019 Scott Shawcroft"
author = "Scott Shawcroft"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'1.0'
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = u'1.0'
release = "1.0"

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

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

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

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

if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
except:
html_theme = 'default'
html_theme_path = ['.']
html_theme = "default"
html_theme_path = ["."]
else:
html_theme_path = ['.']
html_theme_path = ["."]

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

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

# Output file base name for HTML help builder.
htmlhelp_basename = 'AdafruitSsd1608Librarydoc'
htmlhelp_basename = "AdafruitSsd1608Librarydoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'AdafruitSSD1608Library.tex', u'AdafruitSSD1608 Library Documentation',
author, 'manual'),
(
master_doc,
"AdafruitSSD1608Library.tex",
"AdafruitSSD1608 Library Documentation",
author,
"manual",
),
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'AdafruitSSD1608library', u'Adafruit SSD1608 Library Documentation',
[author], 1)
(
master_doc,
"AdafruitSSD1608library",
"Adafruit SSD1608 Library Documentation",
[author],
1,
)
]

# -- Options for Texinfo output -------------------------------------------
Expand All @@ -154,7 +166,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'AdafruitSSD1608Library', u'Adafruit SSD1608 Library Documentation',
author, 'AdafruitSSD1608Library', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"AdafruitSSD1608Library",
"Adafruit SSD1608 Library Documentation",
author,
"AdafruitSSD1608Library",
"One line description of project.",
"Miscellaneous",
),
]
11 changes: 7 additions & 4 deletions examples/ssd1608_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
displayio.release_displays()

# This pinout works on a Feather M4 and may need to be altered for other boards.
spi = board.SPI() # Uses SCK and MOSI
spi = board.SPI() # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6

display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
baudrate=1000000)
display_bus = displayio.FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)

display = adafruit_ssd1608.SSD1608(display_bus, width=200, height=200, busy_pin=epd_busy)
display = adafruit_ssd1608.SSD1608(
display_bus, width=200, height=200, busy_pin=epd_busy
)

g = displayio.Group()

Expand Down

0 comments on commit 59bde46

Please sign in to comment.