kopia lustrzana https://github.com/peterhinch/micropython-micro-gui
pico_epaper_42_v2.py: Change default pin to match hardware.
rodzic
3b6d265810
commit
7a354af87a
|
@ -34,6 +34,7 @@
|
||||||
# Waveshare URLs
|
# Waveshare URLs
|
||||||
# Main page: https://www.waveshare.com/pico-epaper-4.2.htm
|
# Main page: https://www.waveshare.com/pico-epaper-4.2.htm
|
||||||
# Wiki: https://www.waveshare.com/wiki/Pico-ePaper-4.2
|
# 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
|
# Code: https://github.com/waveshareteam/Pico_ePaper_Code/blob/main/python/Pico-ePaper-4.2_V2.py
|
||||||
|
|
||||||
from machine import Pin, SPI
|
from machine import Pin, SPI
|
||||||
|
@ -56,9 +57,8 @@ _EPD_WIDTH = const(400)
|
||||||
_BWIDTH = _EPD_WIDTH // 8
|
_BWIDTH = _EPD_WIDTH // 8
|
||||||
_EPD_HEIGHT = const(300)
|
_EPD_HEIGHT = const(300)
|
||||||
|
|
||||||
_RST_PIN = 12
|
_RST_PIN = 12 # Pin defaults match wiring of Pico socket
|
||||||
# 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 = 8
|
||||||
_DC_PIN = 7
|
|
||||||
_CS_PIN = 9
|
_CS_PIN = 9
|
||||||
_BUSY_PIN = 13
|
_BUSY_PIN = 13
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,16 @@
|
||||||
|
|
||||||
from machine import Pin, SPI, freq
|
from machine import Pin, SPI, freq
|
||||||
import gc
|
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
|
freq(250_000_000) # RP2 overclock
|
||||||
# Create and export an SSD instance
|
# Create and export an SSD instance
|
||||||
prst = Pin(9, Pin.OUT, value=1)
|
prst = Pin(9, Pin.OUT, value=1)
|
||||||
pcs = Pin(10, Pin.OUT, value=1)
|
pcs = Pin(10, Pin.OUT, value=1)
|
||||||
pdc = Pin(8, Pin.OUT, value=0) # Arbitrary pins
|
pdc = Pin(8, Pin.OUT, value=0) # Arbitrary pins
|
||||||
busy = Pin(15, Pin.IN)
|
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)
|
spi = SPI(0, sck=Pin(6), mosi=Pin(7), miso=Pin(4), baudrate=10_000_000)
|
||||||
gc.collect() # Precaution before instantiating framebuf
|
gc.collect() # Precaution before instantiating framebuf
|
||||||
|
|
||||||
|
@ -45,6 +47,7 @@ gc.collect() # Precaution before instantiating framebuf
|
||||||
ssd = SSD(spi, pcs, pdc, prst, busy)
|
ssd = SSD(spi, pcs, pdc, prst, busy)
|
||||||
gc.collect()
|
gc.collect()
|
||||||
from gui.core.ugui import Display, quiet
|
from gui.core.ugui import Display, quiet
|
||||||
|
|
||||||
# quiet()
|
# quiet()
|
||||||
# Create and export a Display instance
|
# Create and export a Display instance
|
||||||
# Define control buttons
|
# Define control buttons
|
||||||
|
|
Ładowanie…
Reference in New Issue