fix readme

This commit is contained in:
hnwangkg-ezio 2019-04-08 16:35:52 +08:00
commit 773eba0e26
7 changed files with 98 additions and 31 deletions

View file

@ -98,6 +98,7 @@ class EPD:
self.reset_pin = epdconfig.RST_PIN self.reset_pin = epdconfig.RST_PIN
self.dc_pin = epdconfig.DC_PIN self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_WIDTH self.width = EPD_WIDTH
self.height = EPD_HEIGHT self.height = EPD_HEIGHT
@ -151,12 +152,16 @@ class EPD:
epdconfig.delay_ms(200) epdconfig.delay_ms(200)
def send_command(self, command): def send_command(self, command):
epdconfig.digital_write(self.dc_pin, GPIO.LOW) epdconfig.digital_write(self.cs_pin, GPIO.LOW)
epdconfig.digital_write(self.dc_pin, GPIO.HIGH)
epdconfig.spi_writebyte([command]) epdconfig.spi_writebyte([command])
epdconfig.digital_write(self.cs_pin, GPIO.HIGH)
def send_data(self, data): def send_data(self, data):
epdconfig.digital_write(self.cs_pin, GPIO.LOW)
epdconfig.digital_write(self.dc_pin, GPIO.HIGH) epdconfig.digital_write(self.dc_pin, GPIO.HIGH)
epdconfig.spi_writebyte([data]) epdconfig.spi_writebyte([data])
epdconfig.digital_write(self.cs_pin, GPIO.HIGH)
def wait_until_idle(self): def wait_until_idle(self):
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy

View file

@ -98,6 +98,7 @@ class EPD:
self.reset_pin = epdconfig.RST_PIN self.reset_pin = epdconfig.RST_PIN
self.dc_pin = epdconfig.DC_PIN self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_WIDTH self.width = EPD_WIDTH
self.height = EPD_HEIGHT self.height = EPD_HEIGHT
@ -151,12 +152,16 @@ class EPD:
epdconfig.delay_ms(200) epdconfig.delay_ms(200)
def send_command(self, command): def send_command(self, command):
epdconfig.digital_write(self.dc_pin, GPIO.LOW) epdconfig.digital_write(self.cs_pin, GPIO.LOW)
epdconfig.digital_write(self.dc_pin, GPIO.HIGH)
epdconfig.spi_writebyte([command]) epdconfig.spi_writebyte([command])
epdconfig.digital_write(self.cs_pin, GPIO.HIGH)
def send_data(self, data): def send_data(self, data):
epdconfig.digital_write(self.cs_pin, GPIO.LOW)
epdconfig.digital_write(self.dc_pin, GPIO.HIGH) epdconfig.digital_write(self.dc_pin, GPIO.HIGH)
epdconfig.spi_writebyte([data]) epdconfig.spi_writebyte([data])
epdconfig.digital_write(self.cs_pin, GPIO.HIGH)
def wait_until_idle(self): def wait_until_idle(self):
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy

View file

@ -82,6 +82,7 @@ class EPD:
self.reset_pin = epdconfig.RST_PIN self.reset_pin = epdconfig.RST_PIN
self.dc_pin = epdconfig.DC_PIN self.dc_pin = epdconfig.DC_PIN
self.busy_pin = epdconfig.BUSY_PIN self.busy_pin = epdconfig.BUSY_PIN
self.cs_pin = epdconfig.CS_PIN
self.width = EPD_WIDTH self.width = EPD_WIDTH
self.height = EPD_HEIGHT self.height = EPD_HEIGHT

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* File Name : readme.txt * File Name : readme.txt
* Description : Readme file * Description : Readme file
* Date : July-28-2017 * Date : 2019-04-08
****************************************************************************** ******************************************************************************
* *
* Copyright (c) 2017 Waveshare * Copyright (c) 2017 Waveshare
@ -66,13 +66,24 @@
* BUSY -> 18 (Physical, BCM: 24) * BUSY -> 18 (Physical, BCM: 24)
== How to use == == How to use ==
1, install the C libraries of bcm2835, see: http://www.airspayce.com/mikem/bcm2835/ 1, open spidev.
2, change the current directory to where the Makefile and demo files located. spi is enabled in config.txt:
3, compile the file with: dtparam=spi=on
or in shell:
sudo raspi-config
- 5 Interfacing Options Configure connections to peripherals
- 5 Interfacing Options Configure connections to peripherals
2, install the C libraries of bcm2835, see: http://www.airspayce.com/mikem/bcm2835/
3, change the current directory to where the Makefile and demo files located.
4, compile the file with:
make make
If you need to see the debug information, clear the execution: # If you need to see the debug information, clear the execution:
make DEBUG=-DDEBUG make DEBUG=-DDEBUG
4, run the demo with:
5, run the demo with:
sudo ./epd sudo ./epd
*/ */

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* File Name : readme.txt * File Name : readme.txt
* Description : Readme file * Description : Readme file
* Date : July-28-2017 * Date : 2019-04-08
****************************************************************************** ******************************************************************************
* *
* Copyright (c) 2017 Waveshare * Copyright (c) 2017 Waveshare
@ -68,10 +68,25 @@
* BUSY -> 18 (Physical, BCM: 24) * BUSY -> 18 (Physical, BCM: 24)
== How to use == == How to use ==
1, install the Python libraries. 1, open spidev.
2, change the current directory to where the demo files located. spi is enabled in config.txt:
3, run the demo with: dtparam=spi=on
python main.py or in shell:
sudo raspi-config
- 5 Interfacing Options Configure connections to peripherals
- 5 Interfacing Options Configure connections to peripherals
2, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
3, change the current directory to where the demo files located.
4, run the demo with:
sudo python main.py
# if use python3:
sudo python3 main.py
*/ */

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* File Name : readme.txt * File Name : readme.txt
* Description : Readme file * Description : Readme file
* Date : July-28-2017 * Date : 2019-04-08
****************************************************************************** ******************************************************************************
* *
* Copyright (c) 2017 Waveshare * Copyright (c) 2017 Waveshare
@ -68,10 +68,25 @@
* BUSY -> 18 (Physical, BCM: 24) * BUSY -> 18 (Physical, BCM: 24)
== How to use == == How to use ==
1, install the Python libraries. 1, open spidev.
2, change the current directory to where the demo files located. spi is enabled in config.txt:
3, run the demo with: dtparam=spi=on
python main.py or in shell:
sudo raspi-config
- 5 Interfacing Options Configure connections to peripherals
- 5 Interfacing Options Configure connections to peripherals
2, install the Python libraries.
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install ttf-wqy-zenhei ttf-wqy-microhei
3, change the current directory to where the demo files located.
4, run the demo with:
sudo python main.py
# if use python3:
sudo python3 main.py
*/ */

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* File Name : readme.txt * File Name : readme.txt
* Description : Readme file * Description : Readme file
* Date : July-28-2017 * Date : 2019-04-08
****************************************************************************** ******************************************************************************
* *
* Copyright (c) 2017 Waveshare * Copyright (c) 2017 Waveshare
@ -66,13 +66,28 @@
* BUSY -> 18 (Physical, BCM: 24) * BUSY -> 18 (Physical, BCM: 24)
== How to use == == How to use ==
1, install the C libraries of bcm2835, see: http://www.airspayce.com/mikem/bcm2835/ 1, open spidev.
2, change the current directory to where the Makefile and demo files located. spi is enabled in config.txt:
3, compile the file with: dtparam=spi=on
or in shell:
sudo raspi-config
- 5 Interfacing Options Configure connections to peripherals
- 5 Interfacing Options Configure connections to peripherals
2, install the C libraries
sudo apt-get install git
sudo git clone git://git.drogon.net/wiringPi
cd wiringPi
sudo ./build
3, change the current directory to where the Makefile and demo files located.
4, compile the file with:
make make
If you need to see the debug information, clear the execution: # If you need to see the debug information, clear the execution:
make DEBUG=-DDEBUG make DEBUG=-DDEBUG
4, run the demo with:
5, run the demo with:
sudo ./epd sudo ./epd
*/ */