Skip to content

Commit 33b8118

Browse files
authored
Merge pull request #1 from tannewt/master
Add examples and lint
2 parents 6106393 + 9f7b7a5 commit 33b8118

File tree

8 files changed

+149
-18
lines changed

8 files changed

+149
-18
lines changed

README.rst

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Installing from PyPI
3131
.. note:: This library is not available on PyPI yet. Install documentation is included
3232
as a standard element. Stay tuned for PyPI availability!
3333

34-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
35-
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
36-
3734
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
3835
PyPI <https://pypi.org/project/adafruit-circuitpython-ssd1675/>`_. To install for current user:
3936

@@ -59,7 +56,46 @@ To install in a virtual environment in your current project:
5956
Usage Example
6057
=============
6158

62-
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
59+
.. code-block:: python
60+
61+
"""Simple test script for 2.13" 250x122 black and white featherwing.
62+
63+
Supported products:
64+
* Adafruit 2.13" Black and White FeatherWing
65+
* https://www.adafruit.com/product/4195
66+
"""
67+
68+
import time
69+
import board
70+
import busio
71+
import displayio
72+
import adafruit_ssd1675
73+
74+
displayio.release_displays()
75+
76+
epd_cs = board.D9
77+
epd_dc = board.D10
78+
79+
display_bus = displayio.FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
80+
time.sleep(1)
81+
82+
display = adafruit_ssd1675.SSD1675(display_bus, width=250, height=122, rotation=90)
83+
84+
g = displayio.Group()
85+
86+
f = open("/display-ruler.bmp", "rb")
87+
88+
pic = displayio.OnDiskBitmap(f)
89+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
90+
g.append(t)
91+
92+
display.show(g)
93+
94+
display.refresh()
95+
96+
print("refreshed")
97+
98+
time.sleep(120)
6399
64100
Contributing
65101
============

adafruit_ssd1675.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
3434
**Hardware:**
3535
36-
.. todo:: Add links to any specific hardware product page(s), or category page(s). Use unordered list & hyperlink rST
37-
inline format: "* `Link Text <url>`_"
36+
* `Adafruit 2.13" Monochrome ePaper Display Breakout <https://www.adafruit.com/product/4197>`_
37+
* `Adafruit 2.13" Black and White FeatherWing <https://www.adafruit.com/product/4195>`_
3838
3939
**Software and Dependencies:**
4040
@@ -49,7 +49,7 @@
4949
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1675.git"
5050

5151
_START_SEQUENCE = (
52-
b"\x12\x00" # Software reset
52+
b"\x12\x80\x02" # Software reset, 2ms delay
5353
b"\x74\x01\x54" # set analog block control
5454
b"\x7e\x01\x3b" # set digital block control
5555
b"\x01\x03\xfa\x01\x00" # driver output control
@@ -60,7 +60,10 @@
6060
b"\x04\x03\x41\xa8\x32" # Set source voltage
6161
b"\x3a\x01\x30" # Set dummy line period
6262
b"\x3b\x01\x0a" # Set gate line width
63-
b"\x32\x46\x80\x60\x40\x00\x00\x00\x00\x10\x60\x20\x00\x00\x00\x00\x80\x60\x40\x00\x00\x00\x00\x10\x60\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\x09\x09\x00\x00\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # LUT
63+
b"\x32\x46\x80\x60\x40\x00\x00\x00\x00\x10\x60\x20\x00\x00\x00\x00\x80\x60\x40\x00\x00\x00\x00"
64+
b"\x10\x60\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\x09\x09\x00\x00"
65+
b"\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
66+
b"\x00\x00\x00" # LUT
6467
)
6568

6669
_STOP_SEQUENCE = (
@@ -71,10 +74,14 @@
7174
class SSD1675(displayio.EPaperDisplay):
7275
"""SSD1675 driver"""
7376
def __init__(self, bus, **kwargs):
74-
color_command = None
75-
super().__init__(bus, _START_SEQUENCE, _STOP_SEQUENCE, **kwargs,
77+
stop_sequence = _STOP_SEQUENCE
78+
try:
79+
bus.reset()
80+
except RuntimeError:
81+
stop_sequence = b""
82+
super().__init__(bus, _START_SEQUENCE, stop_sequence, **kwargs,
7683
ram_width=160, ram_height=296,
7784
set_column_window_command=0x44, set_row_window_command=0x45,
7885
set_current_column_command=0x4e, set_current_row_command=0x4f,
79-
write_black_ram_command=0x24, write_color_ram_command=color_command,
80-
refresh_display_command=0x20)
86+
write_black_ram_command=0x24,
87+
refresh_display_command=0x20, refresh_time=2.2)

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 = ["displayio"]
2424

2525

2626
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}

docs/examples.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
Simple test
22
------------
33

4-
Ensure your device works with this simple test.
4+
Ensure your monochrome featherwing works with this simple test.
55

66
.. literalinclude:: ../examples/ssd1675_simpletest.py
77
:caption: examples/ssd1675_simpletest.py
88
:linenos:
9+
10+
2.13" Monochrome
11+
-----------------
12+
13+
Ensure your 2.13" Monochrome breakout works with this simple test.
14+
15+
.. literalinclude:: ../examples/ssd1675_2.13_monochrome.py
16+
:caption: examples/ssd1675_2.13_monochrome.py
17+
:linenos:

docs/index.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ 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.
26+
Adafruit eInk Display Breakouts <https://learn.adafruit.com/adafruit-eink-display-breakouts>
2827

2928
.. toctree::
3029
:caption: Related Products
3130

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.
31+
Adafruit 2.13" Monochrome ePaper Display Breakout <https://www.adafruit.com/product/4197>
32+
Adafruit 2.13" Black and White FeatherWing <https://www.adafruit.com/product/4195>
3433

3534
.. toctree::
3635
:caption: Other Links

examples/display-ruler.bmp

352 KB
Binary file not shown.

examples/ssd1675_2.13_monochrome.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Simple test script for 2.13" 250x122 monochrome display.
2+
3+
Supported products:
4+
* Adafruit 2.13" Monochrome ePaper Display Breakout
5+
* https://www.adafruit.com/product/4197
6+
"""
7+
8+
import time
9+
import board
10+
import displayio
11+
import adafruit_ssd1675
12+
13+
displayio.release_displays()
14+
15+
# This pinout works on a Feather M4 and may need to be altered for other boards.
16+
spi = board.SPI() # Uses SCK and MOSI
17+
epd_cs = board.D9
18+
epd_dc = board.D10
19+
epd_reset = board.D5
20+
epd_busy = board.D6
21+
22+
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
23+
baudrate=1000000)
24+
time.sleep(1)
25+
26+
display = adafruit_ssd1675.SSD1675(display_bus, width=250, height=122, rotation=90,
27+
busy_pin=epd_busy)
28+
29+
g = displayio.Group()
30+
31+
f = open("/display-ruler.bmp", "rb")
32+
33+
pic = displayio.OnDiskBitmap(f)
34+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
35+
g.append(t)
36+
37+
display.show(g)
38+
39+
display.refresh()
40+
41+
print("refreshed")
42+
43+
time.sleep(120)

examples/ssd1675_simpletest.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Simple test script for 2.13" 250x122 black and white featherwing.
2+
3+
Supported products:
4+
* Adafruit 2.13" Black and White FeatherWing
5+
* https://www.adafruit.com/product/4195
6+
"""
7+
8+
import time
9+
import board
10+
import displayio
11+
import adafruit_ssd1675
12+
13+
displayio.release_displays()
14+
15+
epd_cs = board.D9
16+
epd_dc = board.D10
17+
18+
display_bus = displayio.FourWire(board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000)
19+
time.sleep(1)
20+
21+
display = adafruit_ssd1675.SSD1675(display_bus, width=250, height=122, rotation=90)
22+
23+
g = displayio.Group()
24+
25+
f = open("/display-ruler.bmp", "rb")
26+
27+
pic = displayio.OnDiskBitmap(f)
28+
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
29+
g.append(t)
30+
31+
display.show(g)
32+
33+
display.refresh()
34+
35+
print("refreshed")
36+
37+
time.sleep(120)

0 commit comments

Comments
 (0)