From 7a354af87af93c0ce91ffb356142feb9060227d7 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Mon, 22 Jul 2024 14:22:14 +0100 Subject: [PATCH] pico_epaper_42_v2.py: Change default pin to match hardware. --- drivers/epaper/pico_epaper_42_v2.py | 6 +++--- setup_examples/pico_epaper_42_pico.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/epaper/pico_epaper_42_v2.py b/drivers/epaper/pico_epaper_42_v2.py index 70d32e5..6a02756 100644 --- a/drivers/epaper/pico_epaper_42_v2.py +++ b/drivers/epaper/pico_epaper_42_v2.py @@ -34,6 +34,7 @@ # Waveshare URLs # Main page: https://www.waveshare.com/pico-epaper-4.2.htm # Wiki: https://www.waveshare.com/wiki/Pico-ePaper-4.2 +# Another wiki: https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_Manual#Introduction # Code: https://github.com/waveshareteam/Pico_ePaper_Code/blob/main/python/Pico-ePaper-4.2_V2.py from machine import Pin, SPI @@ -56,9 +57,8 @@ _EPD_WIDTH = const(400) _BWIDTH = _EPD_WIDTH // 8 _EPD_HEIGHT = const(300) -_RST_PIN = 12 -# changed default to 7, as this can be confusing on pico -- pin 8 for SPI1 is the Rx, which overrides DC pin if miso is set to none -_DC_PIN = 7 +_RST_PIN = 12 # Pin defaults match wiring of Pico socket +_DC_PIN = 8 _CS_PIN = 9 _BUSY_PIN = 13 diff --git a/setup_examples/pico_epaper_42_pico.py b/setup_examples/pico_epaper_42_pico.py index 3ab80da..f5598c3 100644 --- a/setup_examples/pico_epaper_42_pico.py +++ b/setup_examples/pico_epaper_42_pico.py @@ -29,14 +29,16 @@ from machine import Pin, SPI, freq import gc -from drivers.epaper.pico_epaper_42 import EPD as SSD +from drivers.epaper.pico_epaper_42 import EPD as SSD # V1 + +# from drivers.epaper.pico_epaper_42_V2 import EPD as SSD # V2 freq(250_000_000) # RP2 overclock # Create and export an SSD instance prst = Pin(9, Pin.OUT, value=1) pcs = Pin(10, Pin.OUT, value=1) pdc = Pin(8, Pin.OUT, value=0) # Arbitrary pins busy = Pin(15, Pin.IN) -# Datasheet allows 10MHz +# V1 UC8176 datasheet allows 10MHz. V2: Waveshare code uses 4MHz spi = SPI(0, sck=Pin(6), mosi=Pin(7), miso=Pin(4), baudrate=10_000_000) gc.collect() # Precaution before instantiating framebuf @@ -45,6 +47,7 @@ gc.collect() # Precaution before instantiating framebuf ssd = SSD(spi, pcs, pdc, prst, busy) gc.collect() from gui.core.ugui import Display, quiet + # quiet() # Create and export a Display instance # Define control buttons