Compare commits
12 commits
pylint_upd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96546f4852 | ||
|
|
9cfa47adde | ||
|
|
74d4851cba | ||
|
|
251ee26bc8 | ||
|
|
5eb2b03e3c | ||
|
|
aec253be41 | ||
|
|
9b2c39886c | ||
|
|
adc9969d52 | ||
|
|
70c43fea68 | ||
|
|
e01711ad0f | ||
|
|
5df78d997a | ||
|
|
477f67c794 |
7 changed files with 142 additions and 113 deletions
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
|
@ -40,9 +40,12 @@ 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: Check formatting
|
||||
run: |
|
||||
black --check --target-version=py35 .
|
||||
- name: PyLint
|
||||
run: |
|
||||
pylint $( find . -path './adafruit*.py' )
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ Examples of unacceptable behavior by participants include:
|
|||
* Excessive or unwelcome helping; answering outside the scope of the question
|
||||
asked
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Promoting or spreading disinformation, lies, or conspiracy theories against
|
||||
a person, group, organisation, project, or community
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
|
|
@ -41,7 +43,7 @@ Examples of unacceptable behavior by participants include:
|
|||
|
||||
The goal of the standards and moderation guidelines outlined here is to build
|
||||
and maintain a respectful community. We ask that you don’t just aim to be
|
||||
"technically unimpeachable", but rather try to be your best self.
|
||||
"technically unimpeachable", but rather try to be your best self.
|
||||
|
||||
We value many things beyond technical expertise, including collaboration and
|
||||
supporting others within our community. Providing a positive experience for
|
||||
|
|
@ -72,10 +74,10 @@ You may report in the following ways:
|
|||
In any situation, you may send an email to <support@adafruit.com>.
|
||||
|
||||
On the Adafruit Discord, you may send an open message from any channel
|
||||
to all Community Helpers by tagging @community moderators. You may also send an
|
||||
open message from any channel, or a direct message to @kattni#1507,
|
||||
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
|
||||
@Andon#8175.
|
||||
to all Community Moderators by tagging @community moderators. You may
|
||||
also send an open message from any channel, or a direct message to
|
||||
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
|
||||
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
|
||||
|
||||
Email and direct message reports will be kept confidential.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Introduction
|
|||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://img.shields.io/discord/327254708534116352.svg
|
||||
:target: https://discord.gg/nBQh6qu
|
||||
:target: https://adafru.it/discord
|
||||
:alt: Discord
|
||||
|
||||
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305/workflows/Build%20CI/badge.svg
|
||||
|
|
|
|||
|
|
@ -52,21 +52,21 @@ __version__ = "0.0.0-auto.0"
|
|||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305.git"
|
||||
|
||||
_INIT_SEQUENCE = (
|
||||
b"\xAE\x00" # DISPLAY_OFF
|
||||
b"\xAE\x00" # DISPLAY_OFF
|
||||
b"\xd5\x01\x80" # SET_DISP_CLK_DIV
|
||||
b"\xA1\x00" # Column 127 is segment 0
|
||||
b"\xA1\x00" # Column 127 is segment 0
|
||||
b"\xA8\x01\x3F" # Mux ratio is 1/64
|
||||
b"\xad\x01\x8e" # Set Master Configuration
|
||||
b"\xd8\x01\x05" # Set Area Color Mode On/Off & Low Power Display Mode
|
||||
b"\x20\x01\x00" # Set memory addressing to horizontal mode.
|
||||
b"\x40\x01\x2E" # SET_DISP_START_LINE ADD
|
||||
b"\xc8\x00" # Set COM Output Scan Direction 64 to 1
|
||||
b"\xc8\x00" # Set COM Output Scan Direction 64 to 1
|
||||
b"\xda\x01\x12" # Set com configuration
|
||||
b"\x91\x04\x3f\x3f\x3f\x3f" # Current drive pulse width of BANK0, Color A, Band C.
|
||||
b"\x91\x04\x3f\x3f\x3f\x3f" # Current drive pulse width of BANK0, Color A, Band C.
|
||||
b"\xd9\x01\xd2" # Set pre-charge period orig: 0xd9, 0x22 if self.external_vcc else 0xf1,
|
||||
b"\xdb\x01\x34" # Set vcom configuration 0xdb, 0x30, $ 0.83* Vcc
|
||||
b"\xA6\x00" # Normal display
|
||||
b"\xA4\x00" # output follows RAM contents SET_ENTIRE_ON
|
||||
b"\xA6\x00" # Normal display
|
||||
b"\xA4\x00" # output follows RAM contents SET_ENTIRE_ON
|
||||
b"\x8d\x01\x14" # Enable charge pump
|
||||
b"\xAF\x00\x00" # DISPLAY_ON
|
||||
)
|
||||
|
|
@ -74,6 +74,7 @@ _INIT_SEQUENCE = (
|
|||
# pylint: disable=too-few-public-methods
|
||||
class SSD1305(displayio.Display):
|
||||
"""SSD1305 driver"""
|
||||
|
||||
def __init__(self, bus, **kwargs):
|
||||
colstart = 0
|
||||
# Patch the init sequence for 32 pixel high displays.
|
||||
|
|
@ -82,12 +83,22 @@ class SSD1305(displayio.Display):
|
|||
height = kwargs["height"]
|
||||
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
|
||||
height = kwargs["width"]
|
||||
init_sequence[9] = height - 1 # patch mux ratio
|
||||
init_sequence[9] = height - 1 # patch mux ratio
|
||||
|
||||
if kwargs["height"] == 32:
|
||||
colstart = 4
|
||||
super().__init__(bus, init_sequence, **kwargs, color_depth=1, grayscale=True,
|
||||
pixels_in_byte_share_row=False,
|
||||
set_column_command=0x21, set_row_command=0x22, data_as_commands=True,
|
||||
set_vertical_scroll=0xd3, brightness_command=0x81,
|
||||
single_byte_bounds=True, colstart=colstart)
|
||||
super().__init__(
|
||||
bus,
|
||||
init_sequence,
|
||||
**kwargs,
|
||||
color_depth=1,
|
||||
grayscale=True,
|
||||
pixels_in_byte_share_row=False,
|
||||
set_column_command=0x21,
|
||||
set_row_command=0x22,
|
||||
data_as_commands=True,
|
||||
set_vertical_scroll=0xD3,
|
||||
brightness_command=0x81,
|
||||
single_byte_bounds=True,
|
||||
colstart=colstart,
|
||||
)
|
||||
|
|
|
|||
112
docs/conf.py
112
docs/conf.py
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
|
@ -10,10 +11,10 @@ sys.path.insert(0, os.path.abspath('..'))
|
|||
# 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!
|
||||
|
|
@ -23,29 +24,32 @@ extensions = [
|
|||
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 DisplayIO_SSD1305 Library'
|
||||
copyright = u'2019 Melissa LeBlanc-Williams'
|
||||
author = u'Melissa LeBlanc-Williams'
|
||||
project = "Adafruit DisplayIO_SSD1305 Library"
|
||||
copyright = "2019 Melissa LeBlanc-Williams"
|
||||
author = "Melissa LeBlanc-Williams"
|
||||
|
||||
# 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.
|
||||
|
|
@ -57,7 +61,7 @@ language = None
|
|||
# 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.
|
||||
|
|
@ -69,7 +73,7 @@ default_role = "any"
|
|||
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
|
||||
|
|
@ -84,59 +88,62 @@ napoleon_numpy_docstring = False
|
|||
# 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 = 'AdafruitDisplayio_ssd1305Librarydoc'
|
||||
htmlhelp_basename = "AdafruitDisplayio_ssd1305Librarydoc"
|
||||
|
||||
# -- 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, 'AdafruitDisplayIO_SSD1305Library.tex', u'AdafruitDisplayIO_SSD1305 Library Documentation',
|
||||
author, 'manual'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitDisplayIO_SSD1305Library.tex",
|
||||
"AdafruitDisplayIO_SSD1305 Library Documentation",
|
||||
author,
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
|
@ -144,8 +151,13 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'AdafruitDisplayIO_SSD1305library', u'Adafruit DisplayIO_SSD1305 Library Documentation',
|
||||
[author], 1)
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitDisplayIO_SSD1305library",
|
||||
"Adafruit DisplayIO_SSD1305 Library Documentation",
|
||||
[author],
|
||||
1,
|
||||
)
|
||||
]
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
|
@ -154,7 +166,13 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'AdafruitDisplayIO_SSD1305Library', u'Adafruit DisplayIO_SSD1305 Library Documentation',
|
||||
author, 'AdafruitDisplayIO_SSD1305Library', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitDisplayIO_SSD1305Library",
|
||||
"Adafruit DisplayIO_SSD1305 Library Documentation",
|
||||
author,
|
||||
"AdafruitDisplayIO_SSD1305Library",
|
||||
"One line description of project.",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -18,15 +18,16 @@ oled_reset = board.D9
|
|||
spi = board.SPI()
|
||||
oled_cs = board.D5
|
||||
oled_dc = board.D6
|
||||
display_bus = displayio.FourWire(spi, command=oled_dc, chip_select=oled_cs,
|
||||
baudrate=1000000, reset=oled_reset)
|
||||
display_bus = displayio.FourWire(
|
||||
spi, command=oled_dc, chip_select=oled_cs, baudrate=1000000, reset=oled_reset
|
||||
)
|
||||
|
||||
# Use for I2C
|
||||
# i2c = board.I2C()
|
||||
# display_bus = displayio.I2CDisplay(i2c, device_address=0x3c, reset=oled_reset)
|
||||
|
||||
WIDTH = 128
|
||||
HEIGHT = 64 # Change to 32 if needed
|
||||
HEIGHT = 64 # Change to 32 if needed
|
||||
BORDER = 8
|
||||
FONTSCALE = 1
|
||||
|
||||
|
|
@ -38,29 +39,33 @@ display.show(splash)
|
|||
|
||||
color_bitmap = displayio.Bitmap(display.width, display.height, 1)
|
||||
color_palette = displayio.Palette(1)
|
||||
color_palette[0] = 0xFFFFFF # White
|
||||
color_palette[0] = 0xFFFFFF # White
|
||||
|
||||
bg_sprite = displayio.TileGrid(color_bitmap,
|
||||
pixel_shader=color_palette,
|
||||
x=0, y=0)
|
||||
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
|
||||
splash.append(bg_sprite)
|
||||
|
||||
# Draw a smaller inner rectangle
|
||||
inner_bitmap = displayio.Bitmap(display.width - BORDER * 2, display.height - BORDER * 2, 1)
|
||||
inner_bitmap = displayio.Bitmap(
|
||||
display.width - BORDER * 2, display.height - BORDER * 2, 1
|
||||
)
|
||||
inner_palette = displayio.Palette(1)
|
||||
inner_palette[0] = 0x000000 # Black
|
||||
inner_sprite = displayio.TileGrid(inner_bitmap,
|
||||
pixel_shader=inner_palette,
|
||||
x=BORDER, y=BORDER)
|
||||
inner_palette[0] = 0x000000 # Black
|
||||
inner_sprite = displayio.TileGrid(
|
||||
inner_bitmap, pixel_shader=inner_palette, x=BORDER, y=BORDER
|
||||
)
|
||||
splash.append(inner_sprite)
|
||||
|
||||
# Draw a label
|
||||
text = "Hello World!"
|
||||
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF)
|
||||
text_width = text_area.bounding_box[2] * FONTSCALE
|
||||
text_group = displayio.Group(max_size=10, scale=FONTSCALE, x=display.width // 2 - text_width // 2,
|
||||
y=display.height // 2)
|
||||
text_group.append(text_area) # Subgroup for text scaling
|
||||
text_group = displayio.Group(
|
||||
max_size=10,
|
||||
scale=FONTSCALE,
|
||||
x=display.width // 2 - text_width // 2,
|
||||
y=display.height // 2,
|
||||
)
|
||||
text_group.append(text_area) # Subgroup for text scaling
|
||||
splash.append(text_group)
|
||||
|
||||
while True:
|
||||
|
|
|
|||
54
setup.py
54
setup.py
|
|
@ -6,6 +6,7 @@ https://github.com/pypa/sampleproject
|
|||
"""
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# To use a consistent encoding
|
||||
from codecs import open
|
||||
from os import path
|
||||
|
|
@ -13,52 +14,41 @@ from os import path
|
|||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# Get the long description from the README file
|
||||
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setup(
|
||||
name='adafruit-circuitpython-displayio-ssd1305',
|
||||
|
||||
name="adafruit-circuitpython-displayio-ssd1305",
|
||||
use_scm_version=True,
|
||||
setup_requires=['setuptools_scm'],
|
||||
|
||||
description='DisplayIO driver for SSD1305 monochrome displays',
|
||||
setup_requires=["setuptools_scm"],
|
||||
description="DisplayIO driver for SSD1305 monochrome displays",
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/x-rst',
|
||||
|
||||
long_description_content_type="text/x-rst",
|
||||
# The project's main homepage.
|
||||
url='https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305',
|
||||
|
||||
url="https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1305",
|
||||
# Author details
|
||||
author='Adafruit Industries',
|
||||
author_email='circuitpython@adafruit.com',
|
||||
|
||||
install_requires=[
|
||||
'Adafruit-Blinka'
|
||||
],
|
||||
|
||||
author="Adafruit Industries",
|
||||
author_email="circuitpython@adafruit.com",
|
||||
install_requires=["Adafruit-Blinka"],
|
||||
# Choose your license
|
||||
license='MIT',
|
||||
|
||||
license="MIT",
|
||||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'Topic :: Software Development :: Libraries',
|
||||
'Topic :: System :: Hardware',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
"Topic :: System :: Hardware",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
],
|
||||
|
||||
# What does your project relate to?
|
||||
keywords='adafruit blinka circuitpython micropython displayio_ssd1305 displayio ssd1305 '
|
||||
'oled',
|
||||
|
||||
keywords="adafruit blinka circuitpython micropython displayio_ssd1305 displayio ssd1305 "
|
||||
"oled",
|
||||
# You can just specify the packages manually here if your project is
|
||||
# simple. Or you can use find_packages().
|
||||
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
|
||||
# CHANGE `py_modules=['...']` TO `packages=['...']`
|
||||
py_modules=['adafruit_displayio_ssd1305'],
|
||||
py_modules=["adafruit_displayio_ssd1305"],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue