initial working commit. Tested with large oled bonnet. colshift is hardcoded

This commit is contained in:
siddacious 2019-09-12 12:45:08 -07:00
parent 99c7c6c192
commit 329b6d07a5
7 changed files with 61 additions and 24 deletions

View file

@ -11,9 +11,6 @@ python:
cache:
pip: true
# TODO: if deployment to PyPi is desired, change 'DEPLOY_PYPI' to "true",
# or remove the env block entirely and remove the condition in the
# deploy block.
env:
- DEPLOY_PYPI="false"
@ -26,12 +23,11 @@ deploy:
overwrite: true
on:
tags: true
# TODO: Use 'travis encrypt --com -r adafruit/<repo slug>' to generate
# the encrypted password for adafruit-travis. Paste result below.
- provider: pypi
user: adafruit-travis
password:
secure: #-- PASTE ENCRYPTED PASSWORD HERE --#
secure: 2PQ1bQpvgzZtRPrrNOMRatxyMDky6h/KE32pxI/vp4wV+S3blefcRZOVUDAfH1PUfnqJD+D4p1wKYGGu86upsQRi0Pc4mam99YQscvV0O5PG0682o+22MU3z0zFRT1rPTXuBNQGY+T/0jwkk7+F4ZfriTfKuB5DzpZZQ4mJ1V1C005qFpKsWIIc9O+K8hbroFm+e6cMVa8NBGW8t13XLG3k/JqWFj3zqwSBVCwb/ti6+7k1XFxwrsa0B9XuBuNRXkhmrQvoeaARMrUAU9hWvWDlEdekglY+5H6o4gCkhsOBwLDmDq1f3AzjJHK8aXM2L6lZLBwOAdjhk2ZYojXQlZ4LRdia2ZLHJmdCSv2k43uwkOV4HfTmCSgIPi2vWPC9aTXd2jqRUB51i6ndNhx8MWHVRhpxmbCD0m6TfwncJiJNApkAhK+BTQbafA2esSHJjuoogB0guZpuSsZoV0aBm7if+Pg7kfHxKOLXrqskJxohSjG5D3LAvcjsgW7ITh8S+xlkpKtKP0GLKeKTkqNNPtYT3aFbwO9zSyErqwG21bQwAv4covLSqsJdx+Uo/kFS86WJR4kWfD3fFm0JI9H9aCiWWxY75FxeAhsHAQ17W5SvotX+EJWGpUx1CBB/9k2cv1Ch6m1P6yv4XzaYTYLvIWFe30h0opdQo8kKSjj7pfXw=
on:
tags: true
condition: $DEPLOY_PYPI = "true"

View file

@ -29,11 +29,6 @@ This is easily achieved by downloading
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-ssd1305/>`_. To install for current user:
@ -60,7 +55,36 @@ 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
# Basic example of clearing and drawing pixels on a SSD1305 OLED display.
# This example and library is meant to work with Adafruit CircuitPython API.
# Author: Tony DiCola
# License: Public Domain
# Import all board pins.
from board import SCL, SDA
import busio
# Import the SSD1305 module.
import adafruit_ssd1305
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
# Create the SSD1305 OLED class.
# The first two parameters are the pixel width and pixel height. Change these
# to the right size for your display!
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
# Alternatively you can change the I2C address of the device with an addr parameter:
#display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31)
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(0)
display.show()
Contributing
============

View file

@ -25,8 +25,8 @@
Framebuf (non-displayio) driver for SSD1305 displays
* Author(s): Bryan Siepert, Tony DiCola, Michael McWethy
* Author(s): Tony DiCola, Michael McWethy, Bryan Siepert
Display init commands taken from
https://www.buydisplay.com/download/democode/ER-OLED022-1_I2C_DemoCode.txt
@ -95,6 +95,7 @@ class _SSD1305(framebuf.FrameBuffer):
if self.reset_pin:
self.reset_pin.switch_to_output(value=0)
self.pages = self.height // 8
self._column_offset = 4 # hardcoded for now...
# Note the subclass must initialize self.framebuf to a framebuffer.
# This is necessary because the underlying data buffer is different
# between I2C and SPI implementations (I2C needs an extra byte).
@ -167,8 +168,8 @@ class _SSD1305(framebuf.FrameBuffer):
xpos0 += 32
xpos1 += 32
self.write_cmd(SET_COL_ADDR)
self.write_cmd(xpos0+4)
self.write_cmd(xpos1+4)
self.write_cmd(xpos0+self._column_offset)
self.write_cmd(xpos1+self._column_offset)
self.write_cmd(SET_PAGE_ADDR)
self.write_cmd(0)
self.write_cmd(self.pages - 1)

View file

@ -20,7 +20,7 @@ extensions = [
# 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 = ["micropython", "adafruit_bus_device", "adafruit_framebuf", "busio"]
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}

View file

@ -23,15 +23,9 @@ 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.
.. toctree::
:caption: Other Links

View file

@ -0,0 +1,23 @@
# Import all board pins.
from board import SCL, SDA
import busio
# Import the SSD1305 module.
import adafruit_ssd1305
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
# Create the SSD1305 OLED class.
# The first two parameters are the pixel width and pixel height. Change these
# to the right size for your display!
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
# Alternatively you can change the I2C address of the device with an addr parameter:
#display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31)
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(0)
display.show()

View file

@ -59,7 +59,6 @@ setup(
# 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_ssd1305'],
)