Skip to content

Commit

Permalink
update Display.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Anomalocaridid committed Jan 26, 2024
1 parent bacc65b commit ad46071
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions docs/en/Display.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,27 @@ Here's how you may initialize the extension. Note that this includes examples of
import board
import busio

from kmk.extensions.display import Display, TextEntry, ImageEntry

# For SSD1306
from kmk.extensions.display.ssd1306 import SSD1306
from kmk.extensions.display import Display, TextEntry, ImageEntry, ssd1306

# Replace SCL and SDA according to your hardware configuration.
i2c_bus = busio.I2C(board.GP_SCL, board.GP_SDA)

driver = SSD1306(
driver = ssd1306.backend(
# Mandatory:
i2c=i2c_bus,
# Optional:
device_address=0x3C,
)

# For SH1106
from kmk.extensions.display.sh1106 import SH1106
from kmk.extensions.display import Display, TextEntry, ImageEntry, sh1106

# Replace SCK and MOSI according to your hardware configuration.
spi_bus = busio.SPI(board.GP_SCK, board.GP_MOSI)

# Replace command, chip_select, and reset according to your hardware configuration.
driver = SH1106(
driver = sh1106.backend(
# Mandatory:
spi=spi_bus,
command=board.GP_DC,
Expand All @@ -62,11 +60,11 @@ driver = SH1106(
)

# For displays initialized by CircuitPython by default
# IMPORTANT: breaks if a display backend from kmk.extensions.display is also in use
from kmk.extensions.display.builtin import BuiltInDisplay
# IMPORTANT: breaks if used alongside another display backend
from kmk.extensions.display import Display, TextEntry, ImageEntry, builtin

# Replace display, sleep_command, and wake_command according to your hardware configuration.
driver = BuiltInDisplay(
driver = builtin.backend(
# Mandatory:
display=board.DISPLAY
sleep_command=0xAE
Expand Down

0 comments on commit ad46071

Please sign in to comment.