/ adafruit_ssd1675.py
adafruit_ssd1675.py
1 # The MIT License (MIT) 2 # 3 # Copyright (c) 2019 Scott Shawcroft for Adafruit Industries LLC 4 # 5 # Permission is hereby granted, free of charge, to any person obtaining a copy 6 # of this software and associated documentation files (the "Software"), to deal 7 # in the Software without restriction, including without limitation the rights 8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 # copies of the Software, and to permit persons to whom the Software is 10 # furnished to do so, subject to the following conditions: 11 # 12 # The above copyright notice and this permission notice shall be included in 13 # all copies or substantial portions of the Software. 14 # 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 # THE SOFTWARE. 22 """ 23 `adafruit_ssd1675` 24 ================================================================================ 25 26 CircuitPython `displayio` drivers for SSD1675-based ePaper displays 27 28 29 * Author(s): Scott Shawcroft 30 31 Implementation Notes 32 -------------------- 33 34 **Hardware:** 35 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>`_ 38 39 **Software and Dependencies:** 40 41 * Adafruit CircuitPython firmware (version 5+) for the supported boards: 42 https://github.com/adafruit/circuitpython/releases 43 44 """ 45 46 import displayio 47 48 __version__ = "0.0.0-auto.0" 49 __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SSD1675.git" 50 51 _START_SEQUENCE = ( 52 b"\x12\x80\x02" # Software reset, 2ms delay 53 b"\x74\x01\x54" # set analog block control 54 b"\x7e\x01\x3b" # set digital block control 55 b"\x01\x03\xfa\x01\x00" # driver output control 56 b"\x11\x01\x03" # Data entry sequence 57 b"\x3c\x01\x03" # Border color 58 b"\x2c\x01\x70" # Vcom Voltage 59 b"\x03\x01\x15" # Set gate voltage 60 b"\x04\x03\x41\xa8\x32" # Set source voltage 61 b"\x3a\x01\x30" # Set dummy line period 62 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" 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 67 ) 68 69 _STOP_SEQUENCE = b"\x10\x01\x01" # Enter deep sleep 70 71 # pylint: disable=too-few-public-methods 72 class SSD1675(displayio.EPaperDisplay): 73 """SSD1675 driver""" 74 75 def __init__(self, bus, **kwargs): 76 stop_sequence = _STOP_SEQUENCE 77 try: 78 bus.reset() 79 except RuntimeError: 80 stop_sequence = b"" 81 super().__init__( 82 bus, 83 _START_SEQUENCE, 84 stop_sequence, 85 **kwargs, 86 ram_width=160, 87 ram_height=296, 88 set_column_window_command=0x44, 89 set_row_window_command=0x45, 90 set_current_column_command=0x4E, 91 set_current_row_command=0x4F, 92 write_black_ram_command=0x24, 93 refresh_display_command=0x20, 94 refresh_time=2.2, 95 )