Skip to content

Commit afdea81

Browse files
authored
Merge pull request #10 from mrmcwethy/redmerst
Updated files to make an interesting ReadToDocs
2 parents fce56de + c4f321e commit afdea81

14 files changed

+457
-9
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
__pycache__
2+
_build
3+
*.pyc
14
.env
25
build*
36
bundles

.pylintrc

+4-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ spelling-store-unknown-words=no
119119
[MISCELLANEOUS]
120120

121121
# List of note tags to take in consideration, separated by a comma.
122-
notes=FIXME,XXX,TODO
122+
# notes=FIXME,XXX,TODO
123+
notes=FIXME,XXX
123124

124125

125126
[TYPECHECK]
@@ -300,7 +301,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
300301

301302
# Good variable names which should always be accepted, separated by a comma
302303
# good-names=i,j,k,ex,Run,_
303-
good-names=r,g,b,i,j,k,n,ex,Run,_
304+
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
304305

305306
# Include a hint for the correct naming format with invalid-name
306307
include-naming-hint=no
@@ -422,7 +423,7 @@ max-returns=6
422423
max-statements=50
423424

424425
# Minimum number of public methods for a class (see R0903).
425-
min-public-methods=2
426+
min-public-methods=1
426427

427428

428429
[EXCEPTIONS]

.readthedocs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
python:
2+
version: 3
3+
requirements_file: requirements.txt

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ deploy:
1616
provider: releases
1717
api_key: $GITHUB_TOKEN
1818
file_glob: true
19-
file: bundles/*
19+
file: $TRAVIS_BUILD_DIR/bundles/*
2020
skip_cleanup: true
21+
overwrite: true
2122
on:
2223
tags: true
2324

2425
install:
25-
- pip install pylint circuitpython-build-tools
26+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2627

2728
script:
2829
- pylint adafruit_ssd1306.py
29-
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
30+
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ssd1306 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

CODE_OF_CONDUCT.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Adafruit Industries
3+
Copyright (c) 2016, 2017 Adafruit Industries
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.rst

+119
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,124 @@
1+
Introduction
2+
============
3+
4+
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ssd1306/badge/?version=latest
5+
:target: https://circuitpython.readthedocs.io/projects/ssd1306/en/latest/
6+
:alt: Documentation Status
7+
8+
.. image:: https://img.shields.io/discord/327254708534116352.svg
9+
:target: https://discord.gg/nBQh6qu
10+
:alt: Discord
11+
12+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_SSD1306.svg?branch=master
13+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_SSD1306
14+
:alt: Build Status
15+
116
Adafruit CircuitPython driver for SSD1306 OLED displays.
217

318
This driver is based on the SSD1306 driver in the MicroPython source but differs
419
by supporting hardware I2C interfaces and Adafruit CircuitPython API. For a
520
MicroPython machine API compatible library see: https://github.com/adafruit/micropython-adafruit-ssd1306
21+
22+
23+
Dependencies
24+
=============
25+
This driver depends on:
26+
27+
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
28+
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
29+
30+
Please ensure all dependencies are available on the CircuitPython filesystem.
31+
This is easily achieved by downloading
32+
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
33+
34+
Usage Example
35+
=============
36+
37+
.. code-block:: python3
38+
39+
# Basic example of clearing and drawing pixels on a SSD1306 OLED display.
40+
# This example and library is meant to work with Adafruit CircuitPython API.
41+
# Author: Tony DiCola
42+
# License: Public Domain
43+
44+
# Import all board pins.
45+
from board import SCL, SDA
46+
import busio
47+
48+
# Import the SSD1306 module.
49+
import adafruit_ssd1306
50+
51+
52+
# Create the I2C interface.
53+
i2c = busio.I2C(SCL, SDA)
54+
55+
# Create the SSD1306 OLED class.
56+
# The first two parameters are the pixel width and pixel height. Change these
57+
# to the right size for your display!
58+
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
59+
# Alternatively you can change the I2C address of the device with an addr parameter:
60+
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)
61+
62+
# Clear the display. Always call show after changing pixels to make the display
63+
# update visible!
64+
display.fill(0)
65+
66+
display.show()
67+
68+
69+
Contributing
70+
============
71+
72+
Contributions are welcome! Please read our `Code of Conduct
73+
<https://github.com/adafruit/adafruit_CircuitPython_SSD1306/blob/master/CODE_OF_CONDUCT.md>`_
74+
before contributing to help this project stay welcoming.
75+
76+
Building locally
77+
================
78+
79+
Zip release files
80+
-----------------
81+
82+
To build this library locally you'll need to install the
83+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
84+
85+
.. code-block:: shell
86+
87+
python3 -m venv .env
88+
source .env/bin/activate
89+
pip install circuitpython-build-tools
90+
91+
Once installed, make sure you are in the virtual environment:
92+
93+
.. code-block:: shell
94+
95+
source .env/bin/activate
96+
97+
Then run the build:
98+
99+
.. code-block:: shell
100+
101+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ssd1306 --library_location .
102+
103+
Sphinx documentation
104+
-----------------------
105+
106+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
107+
install dependencies (feel free to reuse the virtual environment from above):
108+
109+
.. code-block:: shell
110+
111+
python3 -m venv .env
112+
source .env/bin/activate
113+
pip install Sphinx sphinx-rtd-theme
114+
115+
Now, once you have the virtual environment activated:
116+
117+
.. code-block:: shell
118+
119+
cd docs
120+
sphinx-build -E -W -b html . _build/html
121+
122+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
123+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
124+
locally verify it will pass.

adafruit_ssd1306.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
1-
"""SSD1306 OLED driver, I2C and SPI interfaces"""
2-
# MicroPython SSD1306 OLED driver, I2C and SPI interfaces
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2017 Michael McWethy
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
"""
23+
`adafruit_ssd1306`
24+
====================================================
25+
26+
MicroPython SSD1306 OLED driver, I2C and SPI interfaces
27+
28+
* Author(s): Tony DiCola, Michael McWethy
29+
"""
30+
331
import time
432
import framebuf
533

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

docs/api.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
.. If you created a package, create one automodule per module in the package.
3+
4+
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
5+
.. use this format as the module name: "adafruit_foo.foo"
6+
7+
.. automodule:: adafruit_ssd1306
8+
:members:

0 commit comments

Comments
 (0)