diff --git a/1.54inch_e-paper_b_code/python2/epd1in54b.py b/1.54inch_e-paper_b_code/python2/epd1in54b.py index c71af11..5e19094 100644 --- a/1.54inch_e-paper_b_code/python2/epd1in54b.py +++ b/1.54inch_e-paper_b_code/python2/epd1in54b.py @@ -98,6 +98,7 @@ class EPD: self.reset_pin = epdconfig.RST_PIN self.dc_pin = epdconfig.DC_PIN self.busy_pin = epdconfig.BUSY_PIN + self.cs_pin = epdconfig.CS_PIN self.width = EPD_WIDTH self.height = EPD_HEIGHT @@ -151,12 +152,16 @@ class EPD: epdconfig.delay_ms(200) 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.digital_write(self.cs_pin, GPIO.HIGH) def send_data(self, data): + epdconfig.digital_write(self.cs_pin, GPIO.LOW) epdconfig.digital_write(self.dc_pin, GPIO.HIGH) epdconfig.spi_writebyte([data]) + epdconfig.digital_write(self.cs_pin, GPIO.HIGH) def wait_until_idle(self): while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy diff --git a/1.54inch_e-paper_b_code/python3/epd1in54b.py b/1.54inch_e-paper_b_code/python3/epd1in54b.py index 2309d7f..521f5d3 100644 --- a/1.54inch_e-paper_b_code/python3/epd1in54b.py +++ b/1.54inch_e-paper_b_code/python3/epd1in54b.py @@ -98,6 +98,7 @@ class EPD: self.reset_pin = epdconfig.RST_PIN self.dc_pin = epdconfig.DC_PIN self.busy_pin = epdconfig.BUSY_PIN + self.cs_pin = epdconfig.CS_PIN self.width = EPD_WIDTH self.height = EPD_HEIGHT @@ -151,12 +152,16 @@ class EPD: epdconfig.delay_ms(200) 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.digital_write(self.cs_pin, GPIO.HIGH) def send_data(self, data): + epdconfig.digital_write(self.cs_pin, GPIO.LOW) epdconfig.digital_write(self.dc_pin, GPIO.HIGH) epdconfig.spi_writebyte([data]) + epdconfig.digital_write(self.cs_pin, GPIO.HIGH) def wait_until_idle(self): while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy diff --git a/1.54inch_e-paper_c_code/python2/epd1in54.py b/1.54inch_e-paper_c_code/python2/epd1in54.py index 3e45f38..c5907ca 100644 --- a/1.54inch_e-paper_c_code/python2/epd1in54.py +++ b/1.54inch_e-paper_c_code/python2/epd1in54.py @@ -82,6 +82,7 @@ class EPD: self.reset_pin = epdconfig.RST_PIN self.dc_pin = epdconfig.DC_PIN self.busy_pin = epdconfig.BUSY_PIN + self.cs_pin = epdconfig.CS_PIN self.width = EPD_WIDTH self.height = EPD_HEIGHT diff --git a/2.13inch_e-paper_d_code/bcm2835/readme.txt b/2.13inch_e-paper_d_code/bcm2835/readme.txt index b43b704..f660640 100644 --- a/2.13inch_e-paper_d_code/bcm2835/readme.txt +++ b/2.13inch_e-paper_d_code/bcm2835/readme.txt @@ -1,7 +1,7 @@ /****************************************************************************** * File Name : readme.txt * Description : Readme file - * Date : July-28-2017 + * Date : 2019-04-08 ****************************************************************************** * * Copyright (c) 2017 Waveshare @@ -66,13 +66,24 @@ * BUSY -> 18 (Physical, BCM: 24) == How to use == - 1, install the C libraries of bcm2835, see: http://www.airspayce.com/mikem/bcm2835/ - 2, change the current directory to where the Makefile and demo files located. - 3, compile the file with: - make - If you need to see the debug information, clear the execution: - make DEBUG=-DDEBUG - 4, run the demo with: + 1, open spidev. + spi is enabled in config.txt: + 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 + # If you need to see the debug information, clear the execution: + make DEBUG=-DDEBUG + + 5, run the demo with: sudo ./epd */ diff --git a/2.13inch_e-paper_d_code/python2/readme.txt b/2.13inch_e-paper_d_code/python2/readme.txt index ffb8fc9..45151d8 100644 --- a/2.13inch_e-paper_d_code/python2/readme.txt +++ b/2.13inch_e-paper_d_code/python2/readme.txt @@ -1,7 +1,7 @@ /****************************************************************************** * File Name : readme.txt * Description : Readme file - * Date : July-28-2017 + * Date : 2019-04-08 ****************************************************************************** * * Copyright (c) 2017 Waveshare @@ -66,12 +66,27 @@ * D/C -> 22 (Physical, BCM: 25) * RES -> 11 (Physical, BCM: 17) * BUSY -> 18 (Physical, BCM: 24) + + == How to use == + 1, open spidev. + spi is enabled in config.txt: + 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 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 - == How to use == - 1, install the Python libraries. - 2, change the current directory to where the demo files located. - 3, run the demo with: - python main.py + 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 +*/ diff --git a/2.13inch_e-paper_d_code/python3/readme.txt b/2.13inch_e-paper_d_code/python3/readme.txt index ffb8fc9..45151d8 100644 --- a/2.13inch_e-paper_d_code/python3/readme.txt +++ b/2.13inch_e-paper_d_code/python3/readme.txt @@ -1,7 +1,7 @@ /****************************************************************************** * File Name : readme.txt * Description : Readme file - * Date : July-28-2017 + * Date : 2019-04-08 ****************************************************************************** * * Copyright (c) 2017 Waveshare @@ -66,12 +66,27 @@ * D/C -> 22 (Physical, BCM: 25) * RES -> 11 (Physical, BCM: 17) * BUSY -> 18 (Physical, BCM: 24) + + == How to use == + 1, open spidev. + spi is enabled in config.txt: + 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 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 - == How to use == - 1, install the Python libraries. - 2, change the current directory to where the demo files located. - 3, run the demo with: - python main.py + 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 +*/ diff --git a/2.13inch_e-paper_d_code/wiringpi/readme.txt b/2.13inch_e-paper_d_code/wiringpi/readme.txt index b43b704..78185dc 100644 --- a/2.13inch_e-paper_d_code/wiringpi/readme.txt +++ b/2.13inch_e-paper_d_code/wiringpi/readme.txt @@ -1,7 +1,7 @@ /****************************************************************************** * File Name : readme.txt * Description : Readme file - * Date : July-28-2017 + * Date : 2019-04-08 ****************************************************************************** * * Copyright (c) 2017 Waveshare @@ -66,13 +66,28 @@ * BUSY -> 18 (Physical, BCM: 24) == How to use == - 1, install the C libraries of bcm2835, see: http://www.airspayce.com/mikem/bcm2835/ - 2, change the current directory to where the Makefile and demo files located. - 3, compile the file with: + 1, open spidev. + spi is enabled in config.txt: + 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 - If you need to see the debug information, clear the execution: - make DEBUG=-DDEBUG - 4, run the demo with: + # If you need to see the debug information, clear the execution: + make DEBUG=-DDEBUG + + 5, run the demo with: sudo ./epd */