pepopifaceはRaspberry pi の拡張ボードPiFaceを制御するコマンドです

pepopiface.c is controls for Raspberry pi PiFace Digital I/O Expansion Board.

This program uses the libpiface. thanks.

https://github.com/thomasmacpherson/piface

INTSALL:

[root@remote-hand src]# tar xvfz pepopiface.tar.gz
./pepopiface/
./pepopiface/pepopiface.c
./pepopiface/INSTALL
./pepopiface/README
./pepopiface/Makefile
./pepopiface/patch-pfio
[root@remote-hand src]#
[root@remote-hand src]# git clone https://github.com/thomasmacpherson/piface.git
Cloning into 'piface'...
remote: Counting objects: 1387, done.
remote: Compressing objects: 100% (634/634), done.
remote: Total 1387 (delta 673), reused 1360 (delta 648)
Receiving objects: 100% (1387/1387), 529.38 KiB | 151 KiB/s, done.
Resolving deltas: 100% (673/673), done.
[root@remote-hand src]# cd piface/
[root@remote-hand piface]# ls
c  django  easyteach  misc  python  README.md  scratch  scripts
[root@remote-hand piface]# cd c/
[root@remote-hand c]# ls
autogen.sh  configure.ac  examples  Makefile.am  piface-1.0.pc.in  src
[root@remote-hand c]# patch -p0 </usr/src/pepopiface/patch-pfio
[root@remote-hand c]# ./autogen.sh
[root@remote-hand c]# ./configure
[root@remote-hand c]# make
[root@remote-hand c]# make install
[root@remote-hand c]# vi /etc/ld.so.conf.d/piface.conf
/usr/local/lib

[root@remote-hand c]# ll /usr/local/lib/libpiface-1.0.a
rw-r--r-- 1 root root 12364 Jul 20 07:57 /usr/local/lib/libpiface-1.0.a
[root@remote-hand c]# ldconfig

[root@remote-hand c]# cd ../scripts/
[root@remote-hand scripts]# ./spidev-setup
Creating udev rule
Adding user pi to group spiuser
Adding user www-data to group spiuser
User "pi" can now access the /dev/spidev* devices
Please REBOOT for the changes to take effect
root@raspberrypi:/usr/src/piface/scripts#

[root@remote-hand scripts]# cd /usr/src/pepopiface
[root@remote-hand pepopiface]# ls
INSTALL  Makefile  patch-pfio  pepopiface.c  README
[root@remote-hand pepopiface]# make
gcc -Wall -L/usr/local/lib/ -lpiface-1.0 -o pepopiface pepopiface.c
[root@remote-hand pepopiface]# make install
install -s pepopiface /usr/local/bin
[root@remote-hand pepopiface]# pepopiface

[root@remote-hand pepopiface]#
** Welcome to pepopiface Version-0.6 Copyright Yamauchi.Isamu compiled:Aug 21 2015 **
usage:pepopiface port:0-8 [0|1] [timer:0-300000ms]
Enjoy the piface and raspberry pi.

Usage:

/*
Copyright Isamu.Yamauchi 2013-2017. update 2015.8.21
This program uses the libpiface. thanks.
pepopiface.c is controls for Raspberry pi PiFace Digital I/O Expansion Board

o 2013.07.20 ver0.1, 1st release.
o 2013.9.5 ver0.2 , to match the input state of piface, modified to highlight the port data.
o 2014.12.21 ver0.3, add an exclusive processing.
o 2014.12.26 ver0.4, read & write command return value bug fixes.
o 2015.1.11 ver0.5 , add without writing timer option to continuous processing to read.
o 2015.8.21 Ver0.6 , Change the upper limit of 60 seconds timer to 5 minutes.
*/

pepopiface are using Semaphore
First time to start without any options
[root@remote-hand ~]# pepopiface

** Welcome to pepopiface Version-0.6 Copyright Yamauchi.Isamu compiled:Aug 21 2015 **
usage:pepopiface port:0-8 [0|1] [timer:0-300000ms]

[root @ pepopiface] # ipcs -s

------ Semaphore Arrays --------
key semid owner perms nsems
0x530e3700 894009345 root 666 1
[root @ pepopiface] # ls /var/run/pepopiface.semaphore

Semaphore and file is created

usage:
[root@remote-hand ~]# pepopiface

** Welcome to pepopiface Version-0.6 Copyright Yamauchi.Isamu compiled:Aug 21 2015 **
usage:pepopiface port:0-8 [0|1] [timer:0-300000ms]

Concurrent read operation input port and output port
[root@remote-hand ~]# pepopiface 8
00ff[root@remote-hand ~]#
The high-order byte is the output port, the lower byte is the input port.

port0 write 1
[root@remote-hand ~]# pepopiface 0 1
1[root@remote-hand pepopiface]#

port0 write 0
[root@remote-hand ~]# pepopiface 0 0
0[root@remote-hand ~]#

port0 write 1 with timer
This operation is to "1" port of 0th 2 seconds.
[root@remote-hand ~]# pepopiface 0 1 2000
0[root@remote-hand ~]#

port0 read
[root@remote-hand ~]# pepopiface 0
1[root@remote-hand ~]#

Enjoy the piface and raspberry pi.