chiark / gitweb /
OK, so an easier way to manage versions.
authorGordon Henderson <projects@drogon.net>
Sat, 31 Jan 2015 16:43:08 +0000 (16:43 +0000)
committerGordon Henderson <projects@drogon.net>
Sat, 31 Jan 2015 16:43:08 +0000 (16:43 +0000)
Debian package creation - crude, probably violated the Debian policys
but it seems to work just fine...
some other changes.

13 files changed:
VERSION [new file with mode: 0644]
build
debian/wiringPi/DEBIAN/control [new file with mode: 0644]
debian/wiringPi/DEBIAN/postinst [new file with mode: 0755]
debian/wiringPi/DEBIAN/postrm [new file with mode: 0755]
devLib/Makefile
gpio/Makefile
gpio/gpio.c
gpio/newVersion [new file with mode: 0755]
gpio/version.h [new file with mode: 0644]
wiringPi/Makefile
wiringPi/wiringPi.c
wiringPi/wpiExtensions.c

diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..fd6915c
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+2.24
diff --git a/build b/build
index 377bd165b6177f99545c1ca1a46c6b95d15428d5..fb5a8b761ca9a6a5c6e1ac4eeefaccc350cd3829 100755 (executable)
--- a/build
+++ b/build
@@ -73,6 +73,28 @@ if [ x$1 = "xuninstall" ]; then
   exit
 fi
 
+# Only if you know what you're doing!
+
+if [ x$1 = "xdebian" ]; then
+  here=`pwd`
+  cd debian/wiringPi
+  rm -rf usr
+  cd $here/wiringPi
+  make install-deb
+  cd $here/devLib
+  make install-deb
+  cd $here/gpio
+  make install-deb
+  cd $here/debian
+  fakeroot dpkg-deb --build wiringPi
+  mv wiringPi.deb  wiringpi-`cat $here/VERSION`-1.deb
+  exit
+fi
+
+if [ x$1 != "x" ]; then
+  echo "Usage: $0 [clean | uninstall]"
+  exit 1
+fi
 
   echo "wiringPi Build script"
   echo "====================="
@@ -101,11 +123,11 @@ fi
   cd wiringPi
   sudo make uninstall
   if [ x$1 = "xstatic" ]; then
-    make static
+    make -j5 static
     check_make_ok
     sudo make install-static
   else
-    make
+    make -j5
     check_make_ok
     sudo make install
   fi
@@ -116,11 +138,11 @@ fi
   cd ../devLib
   sudo make uninstall
   if [ x$1 = "xstatic" ]; then
-    make static
+    make -j5 static
     check_make_ok
     sudo make install-static
   else
-    make
+    make -j5
     check_make_ok
     sudo make install
   fi
@@ -129,7 +151,7 @@ fi
   echo
   echo "GPIO Utility"
   cd ../gpio
-  make
+  make -j5
   check_make_ok
   sudo make install
   check_make_ok
diff --git a/debian/wiringPi/DEBIAN/control b/debian/wiringPi/DEBIAN/control
new file mode 100644 (file)
index 0000000..73ee094
--- /dev/null
@@ -0,0 +1,10 @@
+Package: wiringpi
+Version: 2.24
+Section: libraries
+Priority: optional
+Architecture: armhf
+Depends: libc6
+Maintainer: Gordon Henderson <projects@drogon.net>
+Description: The wiringPi libraries, headers and gpio command
+  Libraries to allow GPIO access on a Raspberry Pi from C and C++
+  programs as well as from the command-line
diff --git a/debian/wiringPi/DEBIAN/postinst b/debian/wiringPi/DEBIAN/postinst
new file mode 100755 (executable)
index 0000000..4997e98
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+/bin/chown root.root   /usr/bin/gpio
+/bin/chmod 4755                /usr/bin/gpio
+/sbin/ldconfig
diff --git a/debian/wiringPi/DEBIAN/postrm b/debian/wiringPi/DEBIAN/postrm
new file mode 100755 (executable)
index 0000000..4be8c58
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+/sbin/ldconfig
index 4ba17746d7c58d8e2af36041c3c6f84994e515d8..d62b5324e0640384b7fb063fa5e085cb1efa36ec 100644 (file)
@@ -1,7 +1,8 @@
+#
 # Makefile:
 #      wiringPi device - Wiring Compatable library for the Raspberry Pi
 #
-#      Copyright (c) 2012-2013 Gordon Henderson
+#      Copyright (c) 2012-2015 Gordon Henderson
 #################################################################################
 # This file is part of wiringPi:
 #      https://projects.drogon.net/raspberry-pi/wiringpi/
 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
 #################################################################################
 
-DYN_VERS_MAJ=2
-DYN_VERS_MIN=0
-
-VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
+VERSION=$(shell cat ../VERSION)
 DESTDIR=/usr
 PREFIX=/local
 
@@ -34,7 +32,8 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
 DEBUG  = -O2
 CC     = gcc
 INCLUDE        = -I.
-CFLAGS = $(DEBUG) -Wformat=2 -Wall $(INCLUDE) -Winline -pipe -fPIC
+DEFS   = -D_GNU_SOURCE
+CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
 
 LIBS    =
 
@@ -47,6 +46,8 @@ SRC   =       ds1302.c maxdetect.c  piNes.c           \
 
 OBJ    =       $(SRC:.c=.o)
 
+HEADERS        =       ds1302.h gertboard.h  lcd128x64.h  lcd.h  maxdetect.h piFace.h  piGlow.h  piNes.h
+
 all:           $(DYNAMIC)
 
 static:                $(STATIC)
@@ -76,21 +77,11 @@ tags:       $(SRC)
        @ctags $(SRC)
 
 
-.PHONY:        install-headers
-install-headers:
-       @echo "[Install Headers]"
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 ds1302.h               $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 maxdetect.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 piNes.h                $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 gertboard.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 piFace.h               $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 lcd128x64.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 lcd.h                  $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 piGlow.h               $(DESTDIR)$(PREFIX)/include
-
 .PHONY:        install
-install:       $(DYNAMIC) install-headers
+install:       $(DYNAMIC)
+       @echo "[Install Headers]"
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/include
+       @install -m 0644 $(HEADERS)                                     $(DESTDIR)$(PREFIX)/include
        @echo "[Install Dynamic Lib]"
        @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
        @install -m 0755 libwiringPiDev.so.$(VERSION)                   $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
@@ -98,23 +89,29 @@ install:    $(DYNAMIC) install-headers
        @ldconfig
 
 .PHONY:        install-static
-install-static:        $(STATIC) install-headers
+install-static:        $(STATIC)
+       @echo "[Install Headers]"
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/include
+       @install -m 0644 $(HEADERS)                                     $(DESTDIR)$(PREFIX)/include
        @echo "[Install Static Lib]"
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
-       @install -m 0755 libwiringPiDev.a       $(DESTDIR)$(PREFIX)/lib
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
+       @install -m 0755 libwiringPiDev.a                               $(DESTDIR)$(PREFIX)/lib
+
+.PHONY:        install-deb
+install-deb:   $(DYNAMIC)
+       @echo "[Install Headers: deb]"
+       @install -m 0755 -d                                                     ~/wiringPi/debian/wiringPi/usr/include
+       @install -m 0644 $(HEADERS)                                             ~/wiringPi/debian/wiringPi/usr/include
+       @echo "[Install Dynamic Lib: deb]"
+       install -m 0755 -d                                                      ~/wiringPi/debian/wiringPi/usr/lib
+       install -m 0755 libwiringPiDev.so.$(VERSION)                            ~/wiringPi/debian/wiringPi/usr/lib/libwiringPiDev.so.$(VERSION)
+       ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)     ~/wiringPi/debian/wiringPi/usr/lib/libwiringPiDev.so
 
 .PHONY:        uninstall
 uninstall:
        @echo "[UnInstall]"
-       @rm -f $(DESTDIR)$(PREFIX)/include/ds1302.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/maxdetect.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/piNes.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/gertboard.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/piFace.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/lcd128x64.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/lcd.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/piGlow.h
-       @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.*
+       @cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
+       @cd $(DESTDIR)$(PREFIX)/lib/     && rm -f libwiringPiDev.*
        @ldconfig
 
 
index 9c8585f005e17e8710df04324ee75d21310a0230..449986ebd8486c2e44c4a858003e6a108b991269 100644 (file)
@@ -44,6 +44,9 @@ OBJ   =       $(SRC:.c=.o)
 
 all:           gpio
 
+version.h:     ../VERSION
+       ./newVersion
+
 gpio:  $(OBJ)
        @echo [Link]
        @$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
@@ -63,7 +66,7 @@ tags: $(SRC)
        @ctags $(SRC)
 
 .PHONY:        install
-install:
+install: gpio
        @echo "[Install]"
        @cp gpio                $(DESTDIR)$(PREFIX)/bin
        @chown root.root        $(DESTDIR)$(PREFIX)/bin/gpio
@@ -71,6 +74,12 @@ install:
        @mkdir -p               $(DESTDIR)$(PREFIX)/man/man1
        @cp gpio.1              $(DESTDIR)$(PREFIX)/man/man1
 
+.PHONY:        install-deb
+install-deb:   gpio
+       @echo "[Install: deb]"
+       @install -m 0755 -d                                                     ~/wiringPi/debian/wiringPi/usr/bin
+       @install -m 0755 gpio                                                   ~/wiringPi/debian/wiringPi/usr/bin
+
 .PHONY:        uninstall
 uninstall:
        @echo "[UnInstall]"
index 3cee59f9e99a3108fbbcc611e5ddba7c341c258a..461274f615815242cc9a1abd6215b594354e9175 100644 (file)
@@ -40,6 +40,7 @@
 #include <gertboard.h>
 #include <piFace.h>
 
+#include "version.h"
 
 extern int wiringPiDebug ;
 
@@ -53,7 +54,6 @@ extern void doPins       (void) ;
 #  define      FALSE   (1==2)
 #endif
 
-#define        VERSION                 "2.23"
 #define        PI_USB_POWER_CONTROL    38
 #define        I2CDETECT               "/usr/sbin/i2cdetect"
 
diff --git a/gpio/newVersion b/gpio/newVersion
new file mode 100755 (executable)
index 0000000..b8728a5
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# newVersion:
+#      Utility to create the version.h include file for the gpio command.
+#
+#      Copyright (c) 2012-2015 Gordon Henderson
+#################################################################################
+# This file is part of wiringPi:
+#      Wiring Compatable library for the Raspberry Pi
+#
+#    wiringPi is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Lesser General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    wiringPi is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Lesser General Public License for more details.
+#
+#    You should have received a copy of the GNU Lesser General Public License
+#    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
+#################################################################################
+
+rm -f version.h
+echo "#define VERSION \"`cat ../VERSION`\"" > version.h
diff --git a/gpio/version.h b/gpio/version.h
new file mode 100644 (file)
index 0000000..5416bcb
--- /dev/null
@@ -0,0 +1 @@
+#define VERSION "2.24"
index 1a06c35bc3ed2220d53e0707b59a4bb993b0aae1..015a894f144a08d63e8f2c3a6901b97f13fae6e8 100644 (file)
@@ -1,8 +1,8 @@
-# ;
+#
 # Makefile:
 #      wiringPi - Wiring Compatable library for the Raspberry Pi
 #
-#      Copyright (c) 2012 Gordon Henderson
+#      Copyright (c) 2012-2015 Gordon Henderson
 #################################################################################
 # This file is part of wiringPi:
 #      https://projects.drogon.net/raspberry-pi/wiringpi/
 #    along with wiringPi.  If not, see <http://www.gnu.org/licenses/>.
 #################################################################################
 
-DYN_VERS_MAJ=2
-DYN_VERS_MIN=0
-
-VERSION=$(DYN_VERS_MAJ).$(DYN_VERS_MIN)
+VERSION=$(shell cat ../VERSION)
 DESTDIR=/usr
 PREFIX=/local
 
@@ -40,7 +37,6 @@ CFLAGS        = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
 
 LIBS    =
 
-# Should not alter anything below this line
 ###############################################################################
 
 SRC    =       wiringPi.c                                              \
@@ -58,6 +54,21 @@ SRC  =       wiringPi.c                                              \
                drcSerial.c                                             \
                wpiExtensions.c
 
+HEADERS =      wiringPi.h                                              \
+               wiringSerial.h wiringShift.h                            \
+               wiringPiSPI.h wiringPiI2C.h                             \
+               softPwm.h softTone.h                                    \
+               mcp23008.h mcp23016.h mcp23017.h                        \
+               mcp23s08.h mcp23s17.h                                   \
+               sr595.h                                                 \
+               pcf8574.h pcf8591.h                                     \
+               mcp3002.h mcp3004.h mcp4802.h mcp3422.h                 \
+               max31855.h max5322.h                                    \
+               sn3218.h                                                \
+               drcSerial.h                                             \
+               wpiExtensions.h 
+
+
 OBJ    =       $(SRC:.c=.o)
 
 all:           $(DYNAMIC)
@@ -78,6 +89,7 @@ $(DYNAMIC):   $(OBJ)
        @echo [Compile] $<
        @$(CC) -c $(CFLAGS) $< -o $@
 
+
 .PHONY:        clean
 clean:
        @echo "[Clean]"
@@ -89,37 +101,11 @@ tags:      $(SRC)
        @ctags $(SRC)
 
 
-.PHONY:        install-headers
-install-headers:
-       @echo "[Install Headers]"
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPi.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringSerial.h         $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringShift.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 softPwm.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 softTone.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPiSPI.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wiringPiI2C.h          $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 drcSerial.h            $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp23008.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp23016.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp23017.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp23s08.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp23s17.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 max31855.h             $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 max5322.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp3002.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp3004.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp4802.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 mcp3422.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 sr595.h                $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 pcf8574.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 pcf8591.h              $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 sn3218.h               $(DESTDIR)$(PREFIX)/include
-       @install -m 0644 wpiExtensions.h        $(DESTDIR)$(PREFIX)/include
-
 .PHONY:        install
-install:       $(DYNAMIC) install-headers
+install:       $(DYNAMIC)
+       @echo "[Install Headers]"
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/include
+       @install -m 0644 $(HEADERS)                                     $(DESTDIR)$(PREFIX)/include
        @echo "[Install Dynamic Lib]"
        @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
        @install -m 0755 libwiringPi.so.$(VERSION)                      $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
@@ -127,39 +113,29 @@ install:  $(DYNAMIC) install-headers
        @ldconfig
 
 .PHONY:        install-static
-install-static:        $(STATIC) install-headers
+install-static:        $(STATIC)
+       @echo "[Install Headers]"
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/include
+       @install -m 0644 $(HEADERS)                                     $(DESTDIR)$(PREFIX)/include
        @echo "[Install Static Lib]"
-       @install -m 0755 -d                     $(DESTDIR)$(PREFIX)/lib
-       @install -m 0755 libwiringPi.a          $(DESTDIR)$(PREFIX)/lib
+       @install -m 0755 -d                                             $(DESTDIR)$(PREFIX)/lib
+       @install -m 0755 libwiringPi.a                                  $(DESTDIR)$(PREFIX)/lib
+
+.PHONY:        install-deb
+install-deb:   $(DYNAMIC)
+       @echo "[Install Headers: deb]"
+       @install -m 0755 -d                                                     ~/wiringPi/debian/wiringPi/usr/include
+       @install -m 0644 $(HEADERS)                                             ~/wiringPi/debian/wiringPi/usr/include
+       @echo "[Install Dynamic Lib: deb]"
+       install -m 0755 -d                                                      ~/wiringPi/debian/wiringPi/usr/lib
+       install -m 0755 libwiringPi.so.$(VERSION)                               ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)
+       ln -sf ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so.$(VERSION)     ~/wiringPi/debian/wiringPi/usr/lib/libwiringPi.so
 
 .PHONY:        uninstall
 uninstall:
        @echo "[UnInstall]"
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPi.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringSerial.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringShift.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/softPwm.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/softTone.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiSPI.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/wiringPiI2C.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/drcSerial.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp23008.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp23016.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp23017.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s08.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp23s17.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/max31855.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/max5322.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp3002.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp3004.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp4802.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/mcp3422.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/sr595.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/pcf8574.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/pcf8591.h
-       @rm -f $(DESTDIR)$(PREFIX)/include/sn3218.h
-       @rm -f $(DESTDIR)$(PREFIX)/includewpiExtensions.h
-       @rm -f $(DESTDIR)$(PREFIX)/lib/libwiringPi.*
+       @cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS)
+       @cd $(DESTDIR)$(PREFIX)/lib/     && rm -f libwiringPi.*
        @ldconfig
 
 
@@ -195,6 +171,6 @@ max5322.o: wiringPi.h wiringPiSPI.h max5322.h
 sn3218.o: wiringPi.h wiringPiI2C.h sn3218.h
 drcSerial.o: wiringPi.h wiringSerial.h drcSerial.h
 wpiExtensions.o: wiringPi.h mcp23008.h mcp23016.h mcp23017.h mcp23s08.h
-wpiExtensions.o: mcp23s17.h sr595.h pcf8591.h pcf8574.h max31855.h max5322.h
-wpiExtensions.o: mcp3002.h mcp3004.h mcp4802.h mcp3422.h sn3218.h drcSerial.h
-wpiExtensions.o: wpiExtensions.h
+wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h
+wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h sn3218.h
+wpiExtensions.o: drcSerial.h wpiExtensions.h
index 990c641553ca3a25bf160f254405f96af8c2701f..e36af8a24a97b5e674342a94e78b3ad709082f2e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * wiringPi:
- *     Arduino compatable (ish) Wiring library for the Raspberry Pi
- *     Copyright (c) 2012 Gordon Henderson
+ *     Arduino look-a-like Wiring library for the Raspberry Pi
+ *     Copyright (c) 2012-2015 Gordon Henderson
  *     Additional code for pwmSetClock by Chris Hall <chris@kchall.plus.com>
  *
  *     Thanks to code samples from Gert Jan van Loo and the
@@ -131,7 +131,7 @@ struct wiringPiNodeStruct *wiringPiNodes = NULL ;
 //     Taken from Gert/Doms code. Some of this is not in the manual
 //     that I can find )-:
 
-static volatile unsigned int   BCM2708_PERI_BASE =  0x20000000 ;
+static volatile unsigned int    BCM2708_PERI_BASE = 0x20000000 ;       // Variable for Pi2
 #define GPIO_PADS              (BCM2708_PERI_BASE + 0x00100000)
 #define CLOCK_BASE             (BCM2708_PERI_BASE + 0x00101000)
 #define GPIO_BASE              (BCM2708_PERI_BASE + 0x00200000)
@@ -607,7 +607,7 @@ int wiringPiFailure (int fatal, const char *message, ...)
  *
  *     Revision 1 really means the early Model B's.
  *     Revision 2 is everything else - it covers the B, B+ and CM.
- *             ... and the quad core Pi 2 - which is a B+ ++  ...
+ *             ... and the Pi 2 - which is a B+ ++  ...
  *
  *     Seems there are some boards with 0000 in them (mistake in manufacture)
  *     So the distinction between boards that I can see is:
index da41f29ca920bde3adfca3ebc54880540f7458be..4cae9c4150efd0a0e49625eb93e1281e84140e4b 100644 (file)
 #include "mcp23s08.h"
 #include "mcp23s17.h"
 #include "sr595.h"
-#include "pcf8591.h"
 #include "pcf8574.h"
-#include "max31855.h"
-#include "max5322.h"
+#include "pcf8591.h"
 #include "mcp3002.h"
 #include "mcp3004.h"
 #include "mcp4802.h"
 #include "mcp3422.h"
+#include "max31855.h"
+#include "max5322.h"
 #include "sn3218.h"
 #include "drcSerial.h"
 
@@ -664,6 +664,8 @@ static struct extensionFunctionStruct extensionFunctions [] =
 /*
  * loadWPiExtension:
  *     Load in a wiringPi extension
+ *     The extensionData always starts with the name, a colon then the pinBase
+ *     number. Other parameters after that are decoded by the module in question.
  *********************************************************************************
  */
 
@@ -676,7 +678,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
 
   verbose = printErrors ;
 
-// Get the extension extension name by finding the first colon
+// Get the extension name by finding the first colon
 
   p = extension ;
   while (*p != ':')
@@ -688,9 +690,10 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
     }
     ++p ;
   }
-
   *p++ = 0 ;
 
+// Simple ATOI code
+
   if (!isdigit (*p))
   {
     verbError ("%s: pinBase number expected after extension name", progName) ;
@@ -699,7 +702,7 @@ int loadWPiExtension (char *progName, char *extensionData, int printErrors)
 
   while (isdigit (*p))
   {
-    if (pinBase > 1000000000)
+    if (pinBase > 1000000000) // Lets be realistic here...
     {
       verbError ("%s: pinBase too large", progName) ;
       return FALSE ;