Skip to content

Commit 329b6d0

Browse files
committed
initial working commit. Tested with large oled bonnet. colshift is hardcoded
1 parent 99c7c6c commit 329b6d0

File tree

7 files changed

+61
-24
lines changed

7 files changed

+61
-24
lines changed

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ python:
1111
cache:
1212
pip: true
1313

14-
# TODO: if deployment to PyPi is desired, change 'DEPLOY_PYPI' to "true",
15-
# or remove the env block entirely and remove the condition in the
16-
# deploy block.
1714
env:
1815
- DEPLOY_PYPI="false"
1916

@@ -26,12 +23,11 @@ deploy:
2623
overwrite: true
2724
on:
2825
tags: true
29-
# TODO: Use 'travis encrypt --com -r adafruit/<repo slug>' to generate
30-
# the encrypted password for adafruit-travis. Paste result below.
26+
3127
- provider: pypi
3228
user: adafruit-travis
3329
password:
34-
secure: #-- PASTE ENCRYPTED PASSWORD HERE --#
30+
secure: 2PQ1bQpvgzZtRPrrNOMRatxyMDky6h/KE32pxI/vp4wV+S3blefcRZOVUDAfH1PUfnqJD+D4p1wKYGGu86upsQRi0Pc4mam99YQscvV0O5PG0682o+22MU3z0zFRT1rPTXuBNQGY+T/0jwkk7+F4ZfriTfKuB5DzpZZQ4mJ1V1C005qFpKsWIIc9O+K8hbroFm+e6cMVa8NBGW8t13XLG3k/JqWFj3zqwSBVCwb/ti6+7k1XFxwrsa0B9XuBuNRXkhmrQvoeaARMrUAU9hWvWDlEdekglY+5H6o4gCkhsOBwLDmDq1f3AzjJHK8aXM2L6lZLBwOAdjhk2ZYojXQlZ4LRdia2ZLHJmdCSv2k43uwkOV4HfTmCSgIPi2vWPC9aTXd2jqRUB51i6ndNhx8MWHVRhpxmbCD0m6TfwncJiJNApkAhK+BTQbafA2esSHJjuoogB0guZpuSsZoV0aBm7if+Pg7kfHxKOLXrqskJxohSjG5D3LAvcjsgW7ITh8S+xlkpKtKP0GLKeKTkqNNPtYT3aFbwO9zSyErqwG21bQwAv4covLSqsJdx+Uo/kFS86WJR4kWfD3fFm0JI9H9aCiWWxY75FxeAhsHAQ17W5SvotX+EJWGpUx1CBB/9k2cv1Ch6m1P6yv4XzaYTYLvIWFe30h0opdQo8kKSjj7pfXw=
3531
on:
3632
tags: true
3733
condition: $DEPLOY_PYPI = "true"

README.rst

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ This is easily achieved by downloading
2929

3030
Installing from PyPI
3131
=====================
32-
.. note:: This library is not available on PyPI yet. Install documentation is included
33-
as a standard element. Stay tuned for PyPI availability!
34-
35-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
36-
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
3732

3833
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
3934
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:
6055
Usage Example
6156
=============
6257

63-
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
58+
.. code-block:: python
59+
60+
# Basic example of clearing and drawing pixels on a SSD1305 OLED display.
61+
# This example and library is meant to work with Adafruit CircuitPython API.
62+
# Author: Tony DiCola
63+
# License: Public Domain
64+
65+
# Import all board pins.
66+
from board import SCL, SDA
67+
import busio
68+
69+
# Import the SSD1305 module.
70+
import adafruit_ssd1305
71+
72+
73+
# Create the I2C interface.
74+
i2c = busio.I2C(SCL, SDA)
75+
76+
# Create the SSD1305 OLED class.
77+
# The first two parameters are the pixel width and pixel height. Change these
78+
# to the right size for your display!
79+
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
80+
# Alternatively you can change the I2C address of the device with an addr parameter:
81+
#display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31)
82+
83+
# Clear the display. Always call show after changing pixels to make the display
84+
# update visible!
85+
display.fill(0)
86+
87+
display.show()
6488
6589
Contributing
6690
============

adafruit_ssd1305.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
2626
Framebuf (non-displayio) driver for SSD1305 displays
2727
28+
* Author(s): Bryan Siepert, Tony DiCola, Michael McWethy
2829
29-
* Author(s): Tony DiCola, Michael McWethy, Bryan Siepert
3030
Display init commands taken from
3131
https://www.buydisplay.com/download/democode/ER-OLED022-1_I2C_DemoCode.txt
3232
@@ -95,6 +95,7 @@ def __init__(self, buffer, width, height, *, external_vcc, reset):
9595
if self.reset_pin:
9696
self.reset_pin.switch_to_output(value=0)
9797
self.pages = self.height // 8
98+
self._column_offset = 4 # hardcoded for now...
9899
# Note the subclass must initialize self.framebuf to a framebuffer.
99100
# This is necessary because the underlying data buffer is different
100101
# between I2C and SPI implementations (I2C needs an extra byte).
@@ -167,8 +168,8 @@ def show(self):
167168
xpos0 += 32
168169
xpos1 += 32
169170
self.write_cmd(SET_COL_ADDR)
170-
self.write_cmd(xpos0+4)
171-
self.write_cmd(xpos1+4)
171+
self.write_cmd(xpos0+self._column_offset)
172+
self.write_cmd(xpos1+self._column_offset)
172173
self.write_cmd(SET_PAGE_ADDR)
173174
self.write_cmd(0)
174175
self.write_cmd(self.pages - 1)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Uncomment the below if you use native CircuitPython modules such as
2121
# digitalio, micropython and busio. List the modules you use. Without it, the
2222
# autodoc module docs will fail to generate with a warning.
23-
# autodoc_mock_imports = ["digitalio", "busio"]
23+
autodoc_mock_imports = ["micropython", "adafruit_bus_device", "adafruit_framebuf", "busio"]
2424

2525

2626
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)}

docs/index.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26-
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
27-
the toctree above for use later.
28-
2926
.. toctree::
3027
:caption: Related Products
3128

32-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
33-
the toctree above for use later.
34-
3529
.. toctree::
3630
:caption: Other Links
3731

examples/ssd1305_simpletest.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Import all board pins.
2+
from board import SCL, SDA
3+
import busio
4+
5+
# Import the SSD1305 module.
6+
import adafruit_ssd1305
7+
8+
# Create the I2C interface.
9+
i2c = busio.I2C(SCL, SDA)
10+
11+
# Create the SSD1305 OLED class.
12+
# The first two parameters are the pixel width and pixel height. Change these
13+
# to the right size for your display!
14+
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
15+
16+
# Alternatively you can change the I2C address of the device with an addr parameter:
17+
#display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31)
18+
19+
# Clear the display. Always call show after changing pixels to make the display
20+
# update visible!
21+
display.fill(0)
22+
23+
display.show()

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959

6060
# You can just specify the packages manually here if your project is
6161
# simple. Or you can use find_packages().
62-
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
63-
# CHANGE `py_modules=['...']` TO `packages=['...']`
62+
6463
py_modules=['adafruit_ssd1305'],
6564
)

0 commit comments

Comments
 (0)