Skip to content

westy48/PaPiRus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PaPiRus

Resources for PaPiRus ePaper eInk display

Enabling SPI interface on Raspberry Pi

Before using PaPiRus, do not forget to enable the SPI interface. You can enable it by typing sudo raspi-config at the command line and then selecting Advanced options > SPI and then selecting Enable.

Setup PaPiRus

# Run this line and PaPiRus will be setup and installed
curl -sSL https://goo.gl/i1Imel | sudo bash

Getting Started

# Select your screen size
sudo papirus-set [1.44 | 1.9 | 2.0 | 2.6 | 2.7 ]
or
sudo papirus-config
# System will now reboot

Manual Installation

Install Python API

# Install dependencies
sudo apt-get install python-imaging

git clone https://github.com/PiSupply/PaPiRus.git
cd PaPiRus
sudo python setup.py install    # Install PaPirRus python library

Install Driver (Option 1)

papirus-setup    # This will auto install the driver

Install Driver (Option 2)

# Install fuse driver
sudo apt-get install libfuse-dev -y

sudo mkdir /tmp/papirus
cd /tmp/papirus
git clone https://github.com/repaper/gratis.git

cd /tmp/papirus/gratis-master/PlatformWithOS
make rpi-epd_fuse
sudo make rpi-install
sudo service epd-fuse start

Python API

The Basic API

from papirus import Papirus

# The epaper screen object
screen = Papirus()

# Write a bitmap to the epaper screen
screen.display('./path/to/bmp/image')

# Perform a full update to the screen (slower)
screen.update()

# Update only the changed pixels (faster)
screen.partial_update()

# Change screen size
# SCREEN SIZES 1_44INCH | 1_9INCH | 2_0INCH | 2_6INCH | 2_7INCH
screen.set_size(papirus.2_7INCH)

The Text API

from papirus import PapirusText

text = PapirusText()

# Write text to the screen
# text.write(text)
text.write("hello world")

# Write text to the screen at selected point
# text.write(text, (x,y))
text.write("hello world", (10, 10) )

The Image API

from papirus import PapirusImage

image = PapirusImage()

# easy write image to screen
# image.write(path)
image.write('/path/to/image')

# write image to the screen with size and position
# image.write(path, width, (x,y))
image.write('/path/to/image', 20, (10, 10) )

Notes

Your python script must be running with root previlages update the screen and change sizes. This code will only allow the script to run as root

import os
import sys

user = os.getuid()
if user != 0:
    print "Please run script as root"
    sys.exit()

Command Line

# Set the screen size you are using
papirus-set [1.44 | 1.9 | 2.0 | 2.6 | 2.7 ]

# Write data to the screen
papirus-write "Some text to write"

# Draw image on the screen
papirus-draw /path/to/image -t [resize | crop]

# Clear the screen
papirus-clear

Demos

All demos can be seen by running the following commands. Code can be found in the repo for the python bin directory.

# Show clock
papirus-clock

# Run game of life
papirus-gol

# Show system information
papirus-system

# Push framebuffer to screen
papirus-framepush

# Demo of using the buttons
papirus-buttons

# Demo of getting temperature from LM75
papirus-temp

# Snakes game
papirus-snakes

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.6%
  • Shell 15.4%