Skip to content

Update for byte knobs and lint. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ Installing from PyPI
.. note:: This library is not available on PyPI yet. Install documentation is included
as a standard element. Stay tuned for PyPI availability!

.. todo:: Remove the above note if PyPI version is/will be available at time of release.
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-ssd1322/>`_. To install for current user:

Expand All @@ -59,7 +56,26 @@ To install in a virtual environment in your current project:
Usage Example
=============

.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
.. code-block:: python

import time
import board
import busio
import displayio
import adafruit_ssd1322

displayio.release_displays()

# This pinout works on a Metro and may need to be altered for other boards.
spi = busio.SPI(board.SCL, board.SDA)
tft_cs = board.D6
tft_dc = board.D9
tft_reset = board.D5

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

Contributing
============
Expand Down
15 changes: 6 additions & 9 deletions adafruit_ssd1322.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,14 @@

**Hardware:**

.. todo:: Add links to any specific hardware product page(s), or category page(s). Use unordered list & hyperlink rST
inline format: "* `Link Text <url>`_"
* 3.12" Newhaven Display 256x64 Grayscale Blue OLED:
https://www.newhavendisplay.com/nhd31225664ucb2-p-3622.html

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the supported boards:
* Adafruit CircuitPython 5+ firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases

.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies based on the library's use of either.

# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
"""

import displayio
Expand Down Expand Up @@ -73,7 +69,8 @@
b"\xb8\x0f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x10\x40\x90\xa0\xb0\xb4" # Set graytable
# b"\xb9\x00" # Set_Linear_Gray_Scale_Table();//set default linear gray scale table
b"\xb1\x01\xe2" # Set_Phase_Length(0xE2);// Set Phase 1 as 5 Clocks & Phase 2 as 14 Clocks
b"\xd1\x02\xa2\x20" # Set_Display_Enhancement_B(0x20);// Enhance Driving Scheme Capability (0x00/0x20)
# Set_Display_Enhancement_B(0x20);// Enhance Driving Scheme Capability (0x00/0x20)
b"\xd1\x02\xa2\x20"
b"\xbb\x01\x1f" # Set_Precharge_Voltage(0x1F);// Set Pre-Charge Voltage Level as 0.60*VCC
b"\xb6\x01\x08" # Set_Precharge_Period(0x08);// Set Second Pre-Charge Period as 8 Clocks
b"\xbe\x01\x07" # Set_VCOMH(0x07);// Set Common Pins Deselect Voltage Level as 0.86*VCC
Expand All @@ -95,4 +92,4 @@ def __init__(self, bus, **kwargs):
super().__init__(bus, _INIT_SEQUENCE, **kwargs, color_depth=4, grayscale=True,
set_column_command=0x15, set_row_command=0x75,
set_vertical_scroll=0xd3, write_ram_command=0x5c,
single_byte_bounds=True)
single_byte_bounds=True, reverse_pixels_in_byte=True, bytes_per_cell=2)
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "busio"]
autodoc_mock_imports = ["displayio"]


intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
Expand Down
6 changes: 1 addition & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ Table of Contents
.. toctree::
:caption: Tutorials

.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
the toctree above for use later.

.. toctree::
:caption: Related Products

.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
the toctree above for use later.
3.12" Newhaven Display 256x64 Grayscale Blue OLED <https://www.newhavendisplay.com/nhd31225664ucb2-p-3622.html>

.. toctree::
:caption: Other Links
Expand Down
7 changes: 4 additions & 3 deletions examples/ssd1322_gamma.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time
import board
import busio
import displayio
import adafruit_ssd1322
import busio
import time

displayio.release_displays()

Expand All @@ -12,7 +12,8 @@
tft_dc = board.D9
tft_reset = board.D5

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

Expand Down
7 changes: 4 additions & 3 deletions examples/ssd1322_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time
import board
import busio
import displayio
import adafruit_ssd1322
import busio
import time

displayio.release_displays()

Expand All @@ -12,6 +12,7 @@
tft_dc = board.D9
tft_reset = board.D5

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