Skip to content

Commit

Permalink
Merge pull request #49 from jlaba/master
Browse files Browse the repository at this point in the history
Prepared master to create debian packages
  • Loading branch information
hxw authored Aug 18, 2016
2 parents ab46fd7 + e8f97c8 commit fd20fc3
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 39 deletions.
12 changes: 8 additions & 4 deletions PlatformWithOS/Makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Makefile

DESTDIR ?= ""
PREFIX ?= /usr/local
SERVICE ?= initd

PANEL_VERSION ?= NOT-SET
EPD_IO ?= epd_io.h

Expand Down Expand Up @@ -74,18 +78,18 @@ version-check:

.PHONY: rpi raspberrypi
rpi raspberrypi: version-check
$(MAKE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common
$(MAKE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) SERVICE=$(SERVICE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C PlatformWithOS/driver-common

rpi-%: version-check
$(MAKE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common $*
$(MAKE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) SERVICE=$(SERVICE) PLATFORM=../RaspberryPi PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C PlatformWithOS/driver-common $*


# BeagleBone Black targets
# ------------------------

.PHONY: bb beaglebone
bb beaglebone: version-check
$(MAKE) PLATFORM=../BeagleBone PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common
$(MAKE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) PLATFORM=../BeagleBone PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C PlatformWithOS/driver-common

bb-%: version-check
$(MAKE) PLATFORM=../BeagleBone PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C driver-common $*
$(MAKE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) PLATFORM=../BeagleBone PANEL_VERSION="${PANEL_VERSION}" EPD_IO="${EPD_IO}" -C PlatformWithOS/driver-common $*
24 changes: 12 additions & 12 deletions PlatformWithOS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ LED_WHITE P1_21 P9_23 Fashes off/on
LED_PWM P1_12 P9_14 Brightens and dims


Build and run using:
Build and run using (within gratis toplevel directory):

~~~~~
make rpi-gpio_test # bb-gpio_test
sudo ./driver-common/gpio_test
sudo PlatformWithOS/driver-common/gpio_test
~~~~~


Expand All @@ -70,7 +70,7 @@ installed.
sudo modprobe spi-bcm2835
ls -l /dev/spi* ### if no SPI devices present see note below
make rpi-epd_test
sudo ./driver-common/epd_test
sudo PlatformWithOS/driver-common/epd_test
~~~~~

Note: on some version of the image the SPI may be disabled: check the
Expand All @@ -89,7 +89,7 @@ above:

~~~~~
make bb-epd_test
sudo ./driver-common/epd_test
sudo PlatformWithOS/driver-common/epd_test
~~~~~


Expand Down Expand Up @@ -132,11 +132,11 @@ Build and run using:
make rpi-epd_fuse # bb-epd_fuse
sudo modprobe spi-bcm2708 # not on BeagleBone Black (note below)
sudo mkdir /tmp/epd
sudo ./driver-common/epd_fuse --panel=2.0 -o allow_other -o default_permissions /tmp/epd
sudo PlatformWithOS/driver-common/epd_fuse --panel=2.0 -o allow_other -o default_permissions /tmp/epd
cat /tmp/epd/version
cat /tmp/epd/panel
echo C > /tmp/epd/command
./driver-common/xbm2bin < cat_2_0.xbm > /tmp/epd/display
PlatformWithOS/driver-common/xbm2bin < cat_2_0.xbm > /tmp/epd/display
echo U > /tmp/epd/command
# try displaying other images
# to shut down:
Expand Down Expand Up @@ -180,7 +180,7 @@ sudo opkg install python-imaging
Draw some lines, graphics and text

~~~~~
python demo/DrawDemo.py
python PlatformWithOS/demo/DrawDemo.py
~~~~~


Expand All @@ -202,8 +202,8 @@ if the aspect ration of the original image is not the same as the
display.

~~~~~
python demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/cat*
python demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/d*.png
python PlatformWithOS/demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/cat*
python PlatformWithOS/demo/ImageDemo.py /usr/share/scratch/Media/Costumes/Animals/d*.png
~~~~~

## Twitter Demo
Expand Down Expand Up @@ -236,7 +236,7 @@ sudo pip install tweepy
cp tweepy_auth.py-SAMPLE tweepy_auth.py
# *** edit the config
# run the demo (this watches for linux)
python demo/TwitterDemo.py linux
python PlatformWithOS/demo/TwitterDemo.py linux
~~~~~


Expand All @@ -248,7 +248,7 @@ second number is the number of frames to display before the program
exits.

~~~~~
python demo/PartialDemo.py 3 20
python PlatformWithOS/demo/PartialDemo.py 3 20
~~~~~


Expand All @@ -262,7 +262,7 @@ will make the counter appear to go through a sequence like:
Use *Ctrl-C* to stop this program.

~~~~~
python demo/CounterDemo.py 3 20
python PlatformWithOS/demo/CounterDemo.py 3 20
~~~~~


Expand Down
5 changes: 5 additions & 0 deletions PlatformWithOS/directories.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# configure directory paths according to https://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables
EXEC_PREFIX=$(PREFIX)
SBINDIR=$(EXEC_PREFIX)/sbin
SYSCONFDIR=/etc
LIBDIR=$(EXEC_PREFIX)/lib
49 changes: 26 additions & 23 deletions PlatformWithOS/driver-common/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Makefile

PREFIX ?= /usr
DESTIR ?= ""
PREFIX ?= /usr/local
SERVICE ?= initd

include ../directories.mk

PLATFORM ?= ../RasberryPi
PANEL_VERSION ?= v231_g2
Expand Down Expand Up @@ -50,46 +54,45 @@ check-compiled:
# install binary driver ans associated config/startup or service files
.PHONY: install
install: check-compiled
install --group=root --mode=750 --owner=root epd_fuse "${PREFIX}/sbin"
[ -e /etc/default/epd-fuse ] || install --group=root --mode=644 --owner=root epd-fuse.default /etc/default/epd-fuse
ifeq (YES,${IS_ARCH})
install --group=root --mode=644 --owner=root epd-fuse.service "${PREFIX}/lib/systemd/system/epd-fuse.service"
-systemctl daemon-reload
-systemctl enable epd-fuse
test ! -d "${DESTDIR}${SBINDIR}" && mkdir -p "${DESTDIR}${SBINDIR}"
install --group=root --mode=750 --owner=root epd_fuse "${DESTDIR}${SBINDIR}"
test ! -d "${DESTDIR}${SYSCONFDIR}/default" && mkdir -p "${DESTDIR}${SYSCONFDIR}/default"
[ -e "${DESTDIR}${SYSCONFDIR}/default/epd-fuse" ] || install --group=root --mode=644 --owner=root epd-fuse.default "${DESTDIR}${SYSCONFDIR}/default/epd-fuse"
ifeq (systemd,${SERVICE})
test ! -d "${DESTDIR}${LIBDIR}/systemd/system" && mkdir -p "${DESTDIR}${LIBDIR}/systemd/system"
install --group=root --mode=644 --owner=root epd-fuse.service "${DESTDIR}${LIBDIR}/systemd/system/epd-fuse.service"
else # otherwise Debian
if [ -e "${EPD_FUSE_CONF}" ] ; \
then \
install --group=root --mode=644 --owner=root "${EPD_FUSE_CONF}" /etc/init ; \
test ! -d "${DESTDIR}${SYSCONFDIR}/init" && mkdir -p "${DESTDIR}${SYSCONFDIR}/init" ; \
install --group=root --mode=644 --owner=root "${EPD_FUSE_CONF}" "${DESTDIR}${SYSCONFDIR}/init" ; \
fi
if [ -e "${EPD_FUSE_SH}" ] ; \
then \
install --group=root --mode=755 --owner=root "${EPD_FUSE_SH}" /etc/init.d/epd-fuse ; \
update-rc.d epd-fuse defaults ; \
test ! -d "${DESTDIR}${SYSCONFDIR}/init.d" && mkdir -p "${DESTDIR}${SYSCONFDIR}/init.d" ; \
install --group=root --mode=755 --owner=root "${EPD_FUSE_SH}" "${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse" ; \
fi
endif

.PHONY: remove
remove:
[ -x /etc/init.d/epd-fuse ] && /etc/init.d/epd-fuse stop
rm -f "${PREFIX}/sbin/epd_fuse"
ifeq (YES,${IS_ARCH})
-systemctl stop epd-fuse
-systemctl disable epd-fuse
-systemctl daemon-reload
rm -f "${PREFIX}/lib/systemd/system/epd-fuse.service"
[ -x "${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse" ] && "${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse" stop
rm -f "${DESTDIR}${SBINDIR}/epd_fuse"
ifeq (systemd,${SERVICE})
rm -f "${DESTDIR}${LIBDIR}/systemd/system/epd-fuse.service"
else # otherwise Debian
rm -f /etc/init/epd-fuse.conf
rm -f /etc/init.d/epd-fuse
rm -f "${DESTDIR}${SYSCONFDIR}/init/epd-fuse.conf"
rm -f "${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse"
update-rc.d epd-fuse remove
endif
[ -d /dev/epd ] && rmdir /dev/epd
echo NOT Removing: /etc/default/epd-fuse
echo NOT Removing: "${DESTDIR}${SYSCONFDIR}/default/epd-fuse"

.PHONY: test-fuse
test-fuse:
-sudo /etc/init.d/epd-fuse stop
-sudo ${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse stop
-sleep 1
-sudo /etc/init.d/epd-fuse start
-sudo ${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse start
-cat /dev/epd/panel
-echo C > /dev/epd/command
-sleep 1
Expand All @@ -98,7 +101,7 @@ test-fuse:
-sleep 3
-./xbm2bin < cat_2_0.xbm > /dev/epd/display
-echo U > /dev/epd/command
-sudo /etc/init.d/epd-fuse stop
-sudo ${DESTDIR}${SYSCONFDIR}/init.d/epd-fuse stop


# low-level driver
Expand Down
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from distutils.core import setup

setup(name='EPD',
version='0.1',
py_modules=['EPD'],
package_dir = {'': 'PlatformWithOS/demo'},
)

0 comments on commit fd20fc3

Please sign in to comment.