-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathadafruit_ssd1675.py
88 lines (70 loc) · 2.78 KB
/
adafruit_ssd1675.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_ssd1675`
================================================================================
CircuitPython `displayio` drivers for SSD1675-based ePaper displays
* Author(s): Scott Shawcroft
Implementation Notes
--------------------
**Hardware:**
* `Adafruit 2.13" Monochrome ePaper Display Breakout <https://www.adafruit.com/product/4197>`_
* `Adafruit 2.13" Black and White FeatherWing <https://www.adafruit.com/product/4195>`_
**Software and Dependencies:**
* Adafruit CircuitPython firmware (version 5+) for the supported boards:
https://github.com/adafruit/circuitpython/releases
"""
# Starting in CircuitPython 9.x fourwire & EPaperDisplay will be seperate internal
# libraries rather than components of the displayio library
try:
from fourwire import FourWire
from epaperdisplay import EPaperDisplay
except ImportError:
from displayio import FourWire
from displayio import EPaperDisplay
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1675.git"
_START_SEQUENCE = (
b"\x12\x80\x02" # Software reset, 2ms delay
b"\x74\x01\x54" # set analog block control
b"\x7e\x01\x3b" # set digital block control
b"\x01\x03\xfa\x01\x00" # driver output control
b"\x11\x01\x03" # Data entry sequence
b"\x3c\x01\x03" # Border color
b"\x2c\x01\x70" # Vcom Voltage
b"\x03\x01\x15" # Set gate voltage
b"\x04\x03\x41\xa8\x32" # Set source voltage
b"\x3a\x01\x30" # Set dummy line period
b"\x3b\x01\x0a" # Set gate line width
b"\x32\x46\x80\x60\x40\x00\x00\x00\x00\x10\x60\x20\x00\x00\x00\x00\x80\x60\x40\x00\x00\x00\x00"
b"\x10\x60\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\x09\x09\x00\x00"
b"\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00" # LUT
)
_STOP_SEQUENCE = b"\x10\x01\x01" # Enter deep sleep
# pylint: disable=too-few-public-methods
class SSD1675(EPaperDisplay):
"""SSD1675 driver"""
def __init__(self, bus: FourWire, **kwargs) -> None:
stop_sequence = _STOP_SEQUENCE
try:
bus.reset()
except RuntimeError:
stop_sequence = b""
super().__init__(
bus,
_START_SEQUENCE,
stop_sequence,
**kwargs,
ram_width=160,
ram_height=296,
set_column_window_command=0x44,
set_row_window_command=0x45,
set_current_column_command=0x4E,
set_current_row_command=0x4F,
write_black_ram_command=0x24,
refresh_display_command=0x20,
refresh_time=2.2,
address_little_endian=True
)