epaperdisplay
Displays a displayio
object tree on an e-paper display
Available on these boards
- class epaperdisplay.EPaperDisplay(display_bus: busdisplay._DisplayBus, start_sequence: circuitpython_typing.ReadableBuffer, stop_sequence: circuitpython_typing.ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: int | None = None, set_row_window_command: int | None = None, set_current_column_command: int | None = None, set_current_row_command: int | None = None, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: int | None = None, color_bits_inverted: bool = False, highlight_color: int = 0, refresh_display_command: int | circuitpython_typing.ReadableBuffer, refresh_time: float = 40, busy_pin: microcontroller.Pin | None = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False, grayscale: bool = False, advanced_color_epaper: bool = False, two_byte_sequence_length: bool = False, start_up_time: float = 0, address_little_endian: bool = False)
Manage updating an epaper display over a display bus
This initializes an epaper display and connects it into CircuitPython. Unlike other objects in CircuitPython, EPaperDisplay objects live until
displayio.release_displays()
is called. This is done so that CircuitPython can use the display itself.Most people should not use this class directly. Use a specific display driver instead that will contain the startup and shutdown sequences at minimum.
Create a EPaperDisplay object on the given display bus (
fourwire.FourWire
orparalleldisplaybus.ParallelBus
).The
start_sequence
andstop_sequence
are bitpacked to minimize the ram impact. Every command begins with a command byte followed by a byte to determine the parameter count and delay. When the top bit of the second byte is 1 (0x80), a delay will occur after the command parameters are sent. The remaining 7 bits are the parameter count excluding any delay byte. The bytes following are the parameters. When the delay bit is set, a single byte after the parameters specifies the delay duration in milliseconds. The value 0xff will lead to an extra long 500 ms delay instead of 255 ms. The next byte will begin a new command definition.- Parameters:
display_bus – The bus that the display is connected to
start_sequence (ReadableBuffer) – Byte-packed command sequence.
stop_sequence (ReadableBuffer) – Byte-packed command sequence.
width (int) – Width in pixels
height (int) – Height in pixels
ram_width (int) – RAM width in pixels
ram_height (int) – RAM height in pixels
colstart (int) – The index if the first visible column
rowstart (int) – The index if the first visible row
rotation (int) – The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
set_column_window_command (int) – Command used to set the start and end columns to update
set_row_window_command (int) – Command used so set the start and end rows to update
set_current_column_command (int) – Command used to set the current column location
set_current_row_command (int) – Command used to set the current row location
write_black_ram_command (int) – Command used to write pixels values into the update region
black_bits_inverted (bool) – True if 0 bits are used to show black pixels. Otherwise, 1 means to show black.
write_color_ram_command (int) – Command used to write pixels values into the update region
color_bits_inverted (bool) – True if 0 bits are used to show the color. Otherwise, 1 means to show color.
highlight_color (int) – RGB888 of source color to highlight with third ePaper color.
refresh_display_command (int) – Command used to start a display refresh. Single int or byte-packed command sequence
refresh_time (float) – Time it takes to refresh the display before the stop_sequence should be sent. Ignored when busy_pin is provided.
busy_pin (microcontroller.Pin) – Pin used to signify the display is busy
busy_state (bool) – State of the busy pin when the display is busy
seconds_per_frame (float) – Minimum number of seconds between screen refreshes
always_toggle_chip_select (bool) – When True, chip select is toggled every byte
grayscale (bool) – When true, the color ram is the low bit of 2-bit grayscale
advanced_color_epaper (bool) – When true, the display is a 7-color advanced color epaper (ACeP)
two_byte_sequence_length (bool) – When true, use two bytes to define sequence length
start_up_time (float) – Time to wait after reset before sending commands
address_little_endian (bool) – Send the least significant byte (not bit) of multi-byte addresses first. Ignored when ram is addressed with one byte
- update_refresh_mode(start_sequence: circuitpython_typing.ReadableBuffer, seconds_per_frame: float = 180) None
Updates the
start_sequence
andseconds_per_frame
parameters to enable varying the refresh mode of the display.
- refresh() None
Refreshes the display immediately or raises an exception if too soon. Use
time.sleep(display.time_to_refresh)
to sleep until a refresh can occur.
- busy: bool
True when the display is refreshing. This uses the
busy_pin
when available or therefresh_time
otherwise.
- bus: busdisplay._DisplayBus
The bus being used by the display
- root_group: displayio.Group
The root group on the epaper display. If the root group is set to
displayio.CIRCUITPYTHON_TERMINAL
, the default CircuitPython terminal will be shown. If the root group is set toNone
, no output will be shown.