Compiling
These test programs should compile with no additional libraries, but the EPD driver needs the fuse development library installed. And a few examples make us of the Python Imaging Library (PIL)sudo apt-get install libfuse-dev python-imaging # For the Twitter Demo sudo apt-get install python-setuptools sudo easy_install pip git clone https://github.com/repaper/gratis.git cd gratis/PlatformWithOS make rpi sudo make rpi-install
sudo opkg install libfuse-dev python-imaging # For the Twitter demo opkg install python-pip python-setuptools # Extra item for BeagleBone # The program uses device tree files to access the GPIOs git clone https://github.com/nomel/beaglebone.git cp -p beaglebone/gpio-header/generated/gpio-P9.* /lib/firmware git clone https://github.com/repaper/gratis.git cd gratis/PlatformWithOS make bb sudo make bb-install
File Read/Write Description -------- ----------- --------------------------------- version Read Only The driver version number panel Read Only String describing the panel and giving its pixel width and height current Read Only Binary image that matches the currently displayed image (big endian) display Read Write Image being assembled for next display (big endian) temperature Read Write Set this to the current temperature in Celsius command Write Only Execute display operation BE Directory Big endian version of current and display LE Directory Little endian version of current and display Command Byte Description -------- ----- -------------------------------- 'C' 0x43 Clear the EPD, set `current` to all zeros, `display` is not affected 'U' 0x5A Erase `current` from EPD, output `display` to EPD, copy display to `current`
- The default bit ordering for the display is big endian i.e. the top left pixel is the value 0x80 in the first byte.
- The `BE` directory is the same as the root `current` and `display`.
- The `LE` directory `current` and `display` reference the top left pixel as 0x01in the first byte.
- The `current_inverse` and `display_inverse` represent black as zero (0) and white as one (1) while those item without the suffix represent the display's natural coding (0=>white, 1=>black)
- The particular combination of `BE/display_inverse` is used in the Python EPD demo since it fits better with the Imaging library used.
cat /etc/default/epd-fuse
# Default settings for epd-fuse file is sourced by /bin/sh from # /etc/init.d/epd-fuse # Options to pass to epd_fuse #EPD_MOUNTPOINT=/dev/epd #EPD_SIZE=2.0 #EPD_OPTS=
How to edit the configuration file:
sudo nano /etc/default/epd-fuse
sudo service epd-fuse start cat /dev/epd/panel
EPD 2.7 264x176
python demo/DrawDemo.py
Image demo
- Accepts a lists of image files on the command line.
- Converts them to grey scale to ensure formats like PNG, JPEG and GIF will work.
- Inverts the image since the E-Ink panel is reverse (i.e. black on white).
- Converts image to single bit (PIL "1" mode).
- Display the middle of the image (using crop function).
- Delay.
- Display the re-sized image.
- Delay before fetching next file.
python demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/cat* python demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/d*.png
Twitter Demo
Setup easy_install and use it to get pip, then use pip to get tweepy. Copy the sample configuration an edit to include your authentication information. Rather than using the basic authentication it is better to set up a Twitter App and generate a token for this. The token generation is quick atUse Ctrl-C to stop this program.
sudo pip install tweepy # setup the config cp demo/tweepy_auth.py-SAMPLE demo/tweepy_auth.py # *** edit the config nano demo/tweepy_auth.py # run the demo (this watches for linux) python demo/TwitterDemo.py linux
Partial Demo
python demo/PartialDemo.py 3 20
Counter Demo
python demo/CounterDemo.py 3 20