bfd8e166d3
Initial release of v1.5! This place is a teeny bit too small so you should check out the Changelog to see the changes.
36 lines
740 B
Python
36 lines
740 B
Python
import spidev
|
|
import RPi.GPIO as GPIO
|
|
import time
|
|
|
|
# Pin definition
|
|
RST_PIN = 17
|
|
DC_PIN = 25
|
|
CS_PIN = 8
|
|
BUSY_PIN = 24
|
|
|
|
# SPI device, bus = 0, device = 0
|
|
SPI = spidev.SpiDev(0, 0)
|
|
#SPI.no_cs = True
|
|
|
|
def epd_digital_write(pin, value):
|
|
GPIO.output(pin, value)
|
|
|
|
def epd_digital_read(pin):
|
|
return GPIO.input(BUSY_PIN)
|
|
|
|
def epd_delay_ms(delaytime):
|
|
time.sleep(delaytime / 1000.0)
|
|
|
|
def spi_transfer(data):
|
|
SPI.writebytes(data)
|
|
|
|
def epd_init():
|
|
GPIO.setmode(GPIO.BCM)
|
|
GPIO.setwarnings(False)
|
|
GPIO.setup(RST_PIN, GPIO.OUT)
|
|
GPIO.setup(DC_PIN, GPIO.OUT)
|
|
GPIO.setup(CS_PIN, GPIO.OUT)
|
|
GPIO.setup(BUSY_PIN, GPIO.IN)
|
|
SPI.max_speed_hz = 2000000
|
|
SPI.mode = 0b00
|
|
return 0;
|